Maker Pro
Maker Pro

Uart communication protocoals

vead

Nov 27, 2011
473
Joined
Nov 27, 2011
Messages
473
Hello
I know that the use of the Uart Protocol is used to send or receive data from one device to another. For example, if I want to send data from Microcontrlloer to PC. I can send data using uart protocol. Suppose that my name vead is store in 8051 and I want send data "vead" to PC so that I can see my name on PC screen using uart protocal.

2000px-UART_timing_diagram.svg.png

I understand meaning of the start and stop but I don't understand here what the start bit and stop bit ? I think the 8051 first sends the signal to PC. Which means that the PC is ready to receive the data. After that 8051 sends 8 bit data to PC. 8051 sends a stop signal to the PC

Am i thinking right ? Does the uart work like that ?
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,728
Joined
Nov 17, 2011
Messages
13,728
The start bit indicates start of transmission of one byte. it is always logic 0.
The stop bit indicates end of transmission of one byte. It is always logic 1.

Simply follow the links in the Wikipedia article where you copied the above diagram, foremost the "UART Tutorial for Robotics".
 

vead

Nov 27, 2011
473
Joined
Nov 27, 2011
Messages
473
The start bit indicates start of transmission of one byte. it is always logic 0.
The stop bit indicates end of transmission of one byte. It is always logic 1.

Simply follow the links in the Wikipedia article where you copied the above diagram, foremost the "UART Tutorial for Robotics".
I read, when we initialize uart then we set the timer value. Like mention in following program.The timer mode is set in the program. Lowe value high value is loaded in program. But it does not understand how the timer setting is related to the uart communication?

Code:
// Initializing UART in 8051
       
void serial_init()
{
    TMOD = 0x20;
    SCON = 0x50;
    TH1  = 0xFD;
    TL1  = 0xFD;
    TR1  = 1;
   
}
 

kellys_eye

Jun 25, 2010
6,514
Joined
Jun 25, 2010
Messages
6,514
The timer values will relate to the BAUD RATE at which the communication is to be made. Faster baud rate, smaller time interval.
 

Minder

Apr 24, 2015
3,478
Joined
Apr 24, 2015
Messages
3,478
Also if only sending ASCII characters, you can just send 7 bit data rather than 8 bit.
M.
 

vead

Nov 27, 2011
473
Joined
Nov 27, 2011
Messages
473
The timer values will relate to the BAUD RATE at which the communication is to be made. Faster baud rate, smaller time interval.
I have understood from your reply that I have to set the baud rate. I have to Set baud rate to 9600 at 11.0592MH

I don't understand how the baud rate being set in program. Is the following line set baud rate in the program?

TH1 = 0xFD;
TL1 = 0xFD;
 
Top