0% found this document useful (0 votes)
273 views

8051 Serial Port - Mode 0: 10 Bits Are Transmitted / Received

The document describes the different modes of the 8051 serial port: Mode 0 uses fixed baud rate and transfers 8-bit data in and out through RXD and TXD pins. Mode 1 transfers 10-bit data with programmable baud rate using Timer 1 overflow. Mode 2 is similar but allows a 9th data bit and Mode 3 is also similar but uses a fixed baud rate from Timer 1. It provides steps to program the 8051 to transmit and receive data serially using Timer 1 in Mode 2 by loading registers like TMOD, TH1 and SCON before starting Timer 1 and monitoring flags. An example ALP is given to continuously transmit character 'A' at 4800 baud rate.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
273 views

8051 Serial Port - Mode 0: 10 Bits Are Transmitted / Received

The document describes the different modes of the 8051 serial port: Mode 0 uses fixed baud rate and transfers 8-bit data in and out through RXD and TXD pins. Mode 1 transfers 10-bit data with programmable baud rate using Timer 1 overflow. Mode 2 is similar but allows a 9th data bit and Mode 3 is also similar but uses a fixed baud rate from Timer 1. It provides steps to program the 8051 to transmit and receive data serially using Timer 1 in Mode 2 by loading registers like TMOD, TH1 and SCON before starting Timer 1 and monitoring flags. An example ALP is given to continuously transmit character 'A' at 4800 baud rate.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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