[SOLVED] Data Bits UART

Thread Starter

MTech1

Joined Feb 15, 2023
161
UART Frame = Sart bit + number of data bits + Stop bits

Where number of data bits may 5, 6,7,8, and 9 bits

I noticed that UART communication allows for data bits between 5 and 9 bits, with 8 bits being the most common configuration. This can be done on 8-bit, 16-bit, and 32-bit microcontrollers. Have you ever attempted to configure it for 5 bits? If not, I'm curious about the practicality of sending only 5 bits on an 8-bit microcontroller. It seems that if you have a one-character variable and mask 3 bits to send only 5 bits, the receiver will still receive 1 byte
 
Last edited:

BobTPH

Joined Jun 5, 2013
8,922
Five data bits were used for a Teletype's bauddot code. 5 bits provides for capital letters, numbers, and a few special characters.
How did they do that when there are 26 letters and 10 digits?

In answer to the original question: the hardware simply sends the low 5 bits of the 8-bit byte placed to the transmit register. Or maybe it is the high 5.
 

Jon Chandler

Joined Jun 12, 2008
1,043
Sorry, I forgot the detail about switching to alternate character sets when I typed my reply in the middle of the night, but I did provide a link that explains it.

The lack of civility here is beyond belief.
 

Papabravo

Joined Feb 24, 2006
21,220
How did they do that when there are 26 letters and 10 digits?

In answer to the original question: the hardware simply sends the low 5 bits of the 8-bit byte placed to the transmit register. Or maybe it is the high 5.
There were two shift characters called FIGS (Figure Shift) and LTRS (Letter Shift). Letter Shift is the default state, so sending a FIGS changes the shift mode from Letters to Figures (Numbers). A subsequent LTRS would change the shift mode back again. RO-28 Teletype machines, using the Baudot Code, were use on the Stock Exchange and the National Weather service well into the 1970's. Amateur Radio operators still use Baudot Code for RTTY (Radio Teletype) communications.
 

nsaspook

Joined Aug 27, 2009
13,231
There were two shift characters called FIGS (Figure Shift) and LTRS (Letter Shift). Letter Shift is the default state, so sending a FIGS changes the shift mode from Letters to Figures (Numbers). A subsequent LTRS would change the shift mode back again. RO-28 Teletype machines, using the Baudot Code, were use on the Stock Exchange and the National Weather service well into the 1970's. Amateur Radio operators still use Baudot Code for RTTY (Radio Teletype) communications.
One of my old recurring nightmares is about the teletype school I attended at Radioman A school. First had typing class on old Baudot Code machines using random code groups that you had to copy almost perfectly for 5 min. I wasted so many party hours learning to type on the monsters. Then we (Teletype (TTY) Repairman) trained in the electrical and mechanical operation of the devices to repair them, a much easier class for me than typing. They were still using TTY machines well into the 80's.
https://nara.getarchive.net/media/r...-machine-in-the-maintenance-department-67891b
1696363394375.png
This guys typing class experience mirrors mine almost exactly. :eek:
NSFW language
 
Last edited:

Papabravo

Joined Feb 24, 2006
21,220
One of my old recurring nightmares is about of the teletype school I attended at Radioman A school. First had typing class on old Baudot Code machines using random code groups that you had to copy almost perfectly for 5 min. I wasted so many party hours learning to type on the monsters. Then we (Teletype (TTY) Repairman) trained in the electrical and mechanical operation of the devices to repair them, a much easier class for me than typing. They were still using TTY machines well into the 80's.
https://nara.getarchive.net/media/r...-machine-in-the-maintenance-department-67891b
View attachment 304134
This guys typing class experience mirrors mine almost exactly. :eek:
NSFW language
I had a feeling this was part of your experience. Great stuff!
 

Thread Starter

MTech1

Joined Feb 15, 2023
161
Now I see it doesn't matter that the size of the variable, whether it's one byte / four bytes, or we're using an 8-bit microcontroller / a 32-bit microcontroller, When Uart configured for 5 bits. In this configuration, the sender will only transmit either the higher 5 bits or the lower five bits, and the receiver will receive only those five bits.
 

WBahn

Joined Mar 31, 2012
30,011
UART Frame = Sart bit + number of data bits + Stop bits

Where number of data bits may 5, 6,7,8, and 9 bits

I noticed that UART communication allows for data bits between 5 and 9 bits, with 8 bits being the most common configuration. This can be done on 8-bit, 16-bit, and 32-bit microcontrollers. Have you ever attempted to configure it for 5 bits? If not, I'm curious about the practicality of sending only 5 bits on an 8-bit microcontroller. It seems that if you have a one-character variable and mask 3 bits to send only 5 bits, the receiver will still receive 1 byte
If only five bits are sent, then there are only five bits for the receiver to receive. But those five bits are going to be stored in whatever size location it is put, so if that is a 16-bit register (or whatever) five of those bits will be the receive bits and the rest will be something else. Where the five bits end up within that 16 bits and what the "something else" is that the rest of the bits end up being depends on the hardware and/or the software that is running things.
 

Papabravo

Joined Feb 24, 2006
21,220
It is a fact that all UARTS transmit the LSB (Least Significant Bit) first "on the wire". Similarly, all UARTS receive the LSB (Least Significant Bit) first "from the wire". Regardless of the data length setting, the bits always occupy the Least Significant Bist of the data register in the hardware for both transmit and receive.
 
Top