(Created page with "=UART Serial communication using 8051= {{Box|type=l_green_light|text= We have covered the basics of timers in the previous tutorial, with that we can see how c...")
 
Line 8: Line 8:
  
 
From microcontroller programming point of view, there is fundamentally no difference.
 
From microcontroller programming point of view, there is fundamentally no difference.
 
  
 
}}
 
}}
 +
 +
 +
== 8051 UART Registers ==
 +
===SBUFF: Serial buffer register===
 +
 +
{| class="wikitable" style="text-align:center;background-color:#87A96B;margin: 1em auto 1em auto;"
 +
|-
 +
!colspan = '8'|SBUFF
 +
|-
 +
|D7||D6||D5||D4||D3||D2||D1||D0
 +
|-
 +
| ||  ||  ||  || ||  ||  || 
 +
|}
 +
 +
===SCON: Serial Control Register===
 +
 +
{| class="wikitable" style="text-align:center;background-color:#87A96B;margin: 1em auto 1em auto;"
 +
|-
 +
!colspan = '8'|SCON
 +
|-
 +
|D7||D6||D5||D4||D3||D2||D1||D0
 +
|-
 +
|SM0||SM1||SM2||REN||TB8||RB8||TI||RI 
 +
|}
 +
 +
{| class="wikitable" style="text-align:center;background-color:#87A96B;margin: 1em auto 1em auto;"
 +
|-
 +
!SM0||SM1||Operation||Discription||Baud Rate Source
 +
|-
 +
|0||0||Mode 0|| 8bit ShiftReg||1/12 the quartz frequency
 +
|-style="background: blue; color: white"
 +
|0||1||Mode 1|| 8 bit UART||Determined by the timer 1
 +
|-
 +
|1||0||Mode 2|| 9 bit UART||1/32 the quartz frequency
 +
|-
 +
|1||1||Mode 0|| 9 bit UART||Determined by the timer 1
 +
|}

Revision as of 13:14, 27 December 2013

UART Serial communication using 8051

We have covered the basics of timers in the previous tutorial, with that we can see how can a microcontroller communicate with a computer serially.

There are two ways to connect a microcontroller to a computer.

  • Using RS232 protocol to the legacy serial port.
  • Using a USB to serial convertor.

From microcontroller programming point of view, there is fundamentally no difference.


8051 UART Registers

SBUFF: Serial buffer register

SBUFF
D7 D6 D5 D4 D3 D2 D1 D0

SCON: Serial Control Register

SCON
D7 D6 D5 D4 D3 D2 D1 D0
SM0 SM1 SM2 REN TB8 RB8 TI RI
SM0 SM1 Operation Discription Baud Rate Source
0 0 Mode 0 8bit ShiftReg 1/12 the quartz frequency
0 1 Mode 1 8 bit UART Determined by the timer 1
1 0 Mode 2 9 bit UART 1/32 the quartz frequency
1 1 Mode 0 9 bit UART Determined by the timer 1