Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

8051 Serial Port – Mode 0

The Serial Port in Mode-0 has the following features:

1.  Serial data enters and exits through RXD


2. TXD outputs the clock
3.  8 bits are transmitted / received
4.  The baud rate is fixed at (1/12) of the oscillator frequency

8051 Serial Port – Mode 1

The Serial Port in Mode-1 has the following features:


 Serial data enters through RXD
Serial data exits through TXD
On receive, the stop bit goes into RB8 in SCON

10 bits are transmitted / received

1.   Start bit
2.   Data bits (8)
3.   Stop Bit

 Baud rate is determined by the Timer 1 over flow rate.

Standard UART data word under mode-1

8051 Serial Port – Mode 2


The Serial Port in Mode-2 has the following features:

1.  Serial data enters through RXD


2.  Serial data exits through TXD
3.  9th data bit (TB8) can be assign value 0 or 1
4.  On receive, the 9th data  bit goes into RB8 in SCON
5. 11 bits are transmitted / received
1. Start bit
2. Data bits (9)
3. Stop Bit
6. Baud rate is programmable

8051 Serial Port – Mode 3

The Serial Port in Mode-3 has the following features:

1.  Serial data enters through RXD


2.  Serial data exits through TXD
3.  9th data bit (TB8) can be assign value 0 or 1
4.  On receive, the 9th data  bit goes into RB8 in SCON
5. 11 bits are transmitted / received
1. Start bit
2. Data bits (9)
3. Stop Bit
6. Baud rate is determined by Timer 1 overflow rate.

Programming 8051 to transmit/receive data serially

Step I: The TMOD register is loaded with value=20H indicating Use of Timer1 in mode 2 i.e
8-bit Auto-reload
Step II: TH1 register is loaded with one of the values to set the baud rate for serial
communication
Step III: The SCON register is loaded with the value

 MOV SCON, #40H ;indicating serial mode 1


 MOV SCON, #50H ;indicating serial mode 1, Reception enable

Step IV: Start timer1 with instruction setb TR1


Step V: 

 Here: JNB TI, Here ;The TI flag bit is monitored with the use of instruction
 Here: JNB RI, Here ;The RI flag bit is monitored with the use of instruction

Step VI: Clear TI flag before transmission of next character

Write an ALP for 8051 to transmit letter 'A' serially at the baud rate 4800 continuosly

org 00H
MOV TMOD,#20H
MOV TH1,#-6
MOV SCON,#40H
SETB TR1
Again: MOV SBUF,#'A'
Here:JNB TI,Here
clr TI
sjmp Again

You might also like