Embedded

8051 Serial Communication: UART Mode 1, Baud Rate and SBUF

By CourseTron Team ·  5 min read 💬 𝕏 in f

The classic 8051 serial port supports several operating modes. Mode 1 uses asynchronous framing with a start bit, eight data bits and a stop bit. A common baud-rate configuration uses Timer 1 in eight-bit auto-reload mode. The oscillator, timer clock convention and SMOD setting must be stated before calculating TH1.

Reviewed 12 November 2026 · Worked examples with stated assumptions

On this page

Follow one byte through the UART

For an 8N1 frame, the line sends one start bit, eight data bits least significant bit first and one stop bit: ten bit times in total. Sending byte 0x41 therefore does not take only eight bit periods.

At 9,600 bits/s, a complete ten-bit frame takes approximately 1.041667 ms. The maximum uninterrupted payload rate under these framing assumptions is 960 bytes/s before application overhead.

Calculate the Timer 1 reload

For the classic divide-by-12 timer and Timer 1 mode 2:

baud = 2^SMOD * Fosc / (384 * (256 - TH1))

At Fosc=11.0592 MHz, SMOD=0 and baud=9,600, the divisor is 3 and TH1=253=0xFD. The numerical check reproduces 9,600 exactly for this model.

At 12 MHz, the same reload produces approximately 10,416.67 baud, an error of +8.5069%. Do not call it a 9,600-baud setup merely because a familiar hexadecimal value was copied.

SBUF is a transmit and receive interface

Writing SBUF starts a transmit operation; reading SBUF obtains received data from the receive path. The shared SFR address does not mean one ordinary RAM variable is used for both directions. RI and TI report receive/transmit events under the mode’s rules.

For interrupt-driven operation, service both sources appropriately and clear flags as required. In a classic shared serial interrupt, assuming that only receive occurred can leave the transmit flag unhandled.

TTL UART is not an RS-232 electrical interface

A UART defines framing and bit timing. Connector-level voltage requirements are separate. Use a suitable level converter when connecting to an interface that does not match the microcontroller’s logic levels. Confirm ground reference and compatible input/output ranges.

Do not connect a motor supply or an arbitrary serial connector to RXD/TXD based only on the signal names.

A repeatable communication test

  1. Record part, oscillator, mode, reload and framing.
  2. Transmit known patterns such as 0x00, 0xFF, 0x55 and 0x41.
  3. Check bit time and decoded frame with suitable equipment.
  4. Test back-to-back traffic and receive-overrun behavior.
  5. Check timeout and recovery after malformed or missing data.

Our checks verify calculations and frame construction, not a physical serial link.

Common questions

Does 9,600 baud mean 9,600 bytes per second?

No. In this 8N1 binary UART example it means 9,600 bit intervals per second, with ten intervals per payload byte.

Can every 8051 derivative use this same formula?

No. Some use different timer clocks or baud generators. Apply the formula specified for the actual part and mode.

References and practice checks

The practice package includes original arithmetic models, a small RTL simulation and a host C exercise. Each states its test boundary; none is a silicon or board validation claim.