Serial Communication Simulation with Microcontroller.

Oh so What is the microcontroller he is talking with a microscope with the computer! There are protocols to talk about, in a certain way. Talking, that means we will use serial communication for data communication. It can be read about serial communication, how the data communication is done with the microcontroller …, and the project is being used, ATMEGA16 (8MHz), MAX232 IC, DB9 Female connector, and some accessories in Hajaji.
MAX232:
Serial communication using computer for microcontroller communication. But serial communication can not work much longer. Then it is placed on the neck of another protocol named RS232, which can go far away to make the tabbug. And the computer can not accept serial communication without the RS232 protocol. So, two protocols have to be converted in the middle of the middle. MAX232 Possible crossfire, one protocol data is converted to another. The whole thing is like that
In serial communication, a connector called DB9 is to be used, connecting to the computer’s wares and microcontrollers with a gasket. To see the picture below,
It has two variations, mail and filmy. Viewing the picture above with pin diagram can be understood.
Project overview:
Our job is to get some commands from the computer. For example,
Command work
ON LED will burn
OFF LED can be discarded
GET tells the current status of LED to the computer ON: LED is OFF: LED is out
Electronics:
The first part of this project will show how serial communication can be used with the microcontroller. 14, 15 pin at ATMEGA16 is the receiver and transmitter pin of serial communication respectively. Which will send serial data or send them respectively. It has been said before, the head and neck of this serial data will not understand the computer. It now needs to be converted to RS232 protocol. For this 14 and 15 Pinduto MAX232 have been installed on 12 and 11 pins, which are the MAX232 serial data. And 14, 13 pins are the RS232 data of those that are just converted from serial. These data will be on the computer, as a DB9 phone connector. The basic diagram of the MAX232 connection is,
The whole circuit is connected to the following (with an LED and fitted with)
There are two more things to talk about. In the above picture, there are two things called Terminal 1 and Terminal 2 that are only for debugging or testing. For example, on Terminal 1, on the ON enter, enter the name D1 and the OFF will be written off. Terminal 1 can be imagined in a computer’s place. Again in Terminal 2, it turns out that what is going on with Terminal 1 – in the microcontroller. Run a simulation at Proteus and write the above table commands in Terminal 1. Likewise, the GET and press Enter will show the status of the LEDs (ON or OFF) in the terminal. It can be read about Proteus software, fun software to create circuits: Proteus.
Programming:
MikroC’s serial communication library has been used in code code. Let’s see the code first,
Void main () {
Char buffer [10];
Char i;
DDB0_bit = 1;
PORTB0_bit = 0;
UART1_Init (9600);
Delay_ms (100);
While (1) {
If (UART1_Data_Ready ()) {
UART1_Read_Text (buffer, “\ r”, 8);
For (i = 0; i buffer [i] = tolower (buffer [i]);
}
If (! Strcmp (buffer, “on”)) {
PORTB0_bit = 1;
} Else if (! Strcmp (buffer, “off”)) {
PORTB0_bit = 0;
} Else if (! Strcmp (buffer, “get”)) {
If (PORTB0_bit) {
UART1_Write_Text (“ON \ r \ n”);
} Else {
UART1_Write_Text (“OFF \ r \ n”);
}
}
}
}
}
Explanation:
Checking the microcontroller, there is no data on the serial. If there is a Tamil mandate according to the table above. Transmitting LED status is necessary if necessary.
The next part will be the connection with the computer and the command from the computer.