UART/One byte on one wire/The data bits, low bit first
Lesson 3 of 12 · in 3D and VR

The data bits, low bit first

A byte is a number from 0 to 255, and a UART puts it on the wire one bit at a time, lowest bit first. The pattern you read on the line is the number written backwards, and the UART neither knows nor cares what the number means.

Lonely BinaryUpdated 2026-10-014 min readNo board required

View it in VR

Lesson 3 of the UART course opens in a VR headset, on a table in front of you, and a voice starts three seconds after you arrive. Type this short address into the browser on a headset such as Meta Quest or Apple Vision Pro, and press Enter VR. No headset? Press Start the lesson: the same lesson, full screen.

learn.lonelybinary.com/vr/uart/3

A byte is a number

What a UART sends is a number. With eight bits it is any value from 0 to 255, and nothing in the hardware gives some values a meaning. A character code on a terminal, a sensor reading and half of a larger number are all the same thing on the wire: eight levels, high or low.

The number 193 is 0xC1 in hex and 11000001 in binary. Binary is written with the highest bit on the left, the way you write any number, with the largest place first.

Bit 0 first

After the start bit, the data bits go out in order from bit 0, the lowest, which counts as 1, up to the highest. The frame in the ESP32 reference manual runs from BIT0 to BITn, and that is the order. So 0xC1 does not go out as 11000001. It goes out as 1, 0, 0, 0, 0, 0, 1, 1: the right-hand end of the written number first.

The receiver does the reverse. It takes the first bit it reads as bit 0, the next as bit 1, and so on, and builds the number back up. Nothing is lost, as long as both ends agree on the order. Bit 0 first is the convention, and nothing here asks you to choose it.

Five to eight bits

The number of data bits is a setting. An ESP32 can send 5, 6, 7 or 8, and 8 is the usual. The UARTs of the ESP32 and ESP32-S3 have no 9-bit mode.

A shorter word has fewer values and takes fewer beats. Five bits hold 32 values, seven hold 128, which is enough for the codes of plain ASCII text. The frame also gets one beat shorter for each bit dropped, so each byte takes less time at the same baud.

What it costs

Both ends have to be set to the same length. The receiver is a counter: it reads as many data bits as its own setting says and then expects the stop bit. If it is set to seven while the sender sends eight, it takes the eighth data bit for the stop bit. A low there is a framing error. A high there passes without a word, and the top bit of every byte is simply gone. Lesson 7 shows what a disagreement looks like.

Common mistakes

  • Reading a trace left to right as ordinary binary. The first bit after the start is the lowest, so a trace of 1 0 0 0 0 0 1 1 is 0xC1, and read as written it would be 0x83. Reverse it before you read it.
  • Setting 7 data bits because the data is text, then sending bytes above 127. The 0xC1 you send arrives as 0x41, and no error flag says so.
  • Expecting the UART to know about letters. It carries numbers. The program or the terminal decides which number is a letter.

Edit this page — content/fundamentals/uart/data-bits.mdx

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Fundamentals on the forum →