UART routines
| Name | UART.C |
| Revision | V1.1 - September 21st, 2002 |
| Code size | 531 bytes with Keil V5.50 compiler |
| Needed RAM size | 31 bytes + RX and TX buffers (defautl is 256 bytes each) |
This code allow to implement the hardware UART feature in the 8051 microcontrollers. It'is using timer1 as a baudrate generator.
The transmit and receive are performed on interrupt. A transmit and receiver buffer is automatically filled when characters are sent or received. This way allows to receive on interrupts while the software is doing something else and to do the treatments regularly (in the main loop or as I prefer in a path of the real time sequencer described here.
The baudrate is automatically computed according to the crystal frequency.
For whose who want to compute themselve, I've made an Excel sheet allowing to compute the TH1 register according to the desired baudrate. You can download it here (XLS, 20Kb)
You can Download the code here (ZIP, 3Kb).