Table of Contents

UART on the 8051

Configuration

In order to configure the following registers must be initialized:

SCON (Serial port control register)

Configuration: 01010000

TMOD (Timer/counter mode control register)

Since UART uses Timer 1, we only need to configure the upper nibble.

Configuration: 0010XXXX

TCON

Configuration: 01XX0XXX

TH1

$$ TH1 = 256 - \frac{K(f_{OSC})}{384f_{BAUD}} $$

Receiving

mov A, SBUF ; Store the received byte in the accumulator.

Transmitting

mov SBUF, A ; Transmit the byte stored in the accmulator.