Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am asking this stupid question for my general knowledge. Why in serial protocol often send least significant bit first? For example, in UART, data byte 10101100b (0xAC) is send as 00110101b (0x35). What protocol designer may have considered?

share|improve this question
If your working in assembler there may just be a convienient instruction that helps make it easier ("Skip if [counter] zero" for example, then a count down is better). However all the protocols related to PC serial ports use Most Signifcant Bits first. If you control the the TX and the RX then it doesn't matter except when some one else needs to decode it. .. – Spoon Apr 10 '14 at 11:44

if you are building up a number in binary, the 'right hand' bit is the least significant, and the processes is usually counting 'up' the index, or 'bit position' which goes left towards the most significant bit. This of course is entirely related to the "endian-ness" of the system architecture - which determines if it's the 7th or the zero-th bit as most significant.

A psuedo code for the receiver in a shift register of a UART might be:

  • Oh look, i detected a start bit!
  • oh look here are more bits coming in which match my baud rate settings! (timeout hasn't occurred, and not too fast to be considered noise, etc)
  • for each bit, starting index 0, if bit is high, put a 1 into the shift register, else put a zero into the shift register
  • after the x number of data bits (could be 8-10 data bits in a serial frame) process is finished, and set flag for microcontroller to read my receive data register!

    All of this is followed of course by 1 or 2 stop bits, and then the data line is kept at whatever idle level (usually high?) until the next transmission is detected.

Same style of thinking is used for bit-banging by software serial - as the pin level changes, increase the bit index and set/reset the bit on a "received byte" variable. It's essentially based on endian-ness of the system (little or big endian) and the fact that programmers like to use 0-indexing and starting at the lower end of a variable. Hardware UART transmit shift registers usually shift data out "backwards" than what you expect, as you mentioned in your question.

share|improve this answer

As far as I'm aware, it was an arbitrary choice made at the time the async serial protocol was conceived. Other serial protocols, e.g. SPI, send the MSB first. The latter seems more natural to me, but ultimately it makes very little difference.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.