Sending data MDB or LSB first order. Why?
jdolecki
Posts: 726
What is the reason in for choosing to send data with MSB or LSB first order?
I'm assuming there is a reason I have a choice in doing this . I just don't see any difference.
Some of my chips let me choose this as an option in sending data using SPI.
Thanks
I'm assuming there is a reason I have a choice in doing this . I just don't see any difference.
Some of my chips let me choose this as an option in sending data using SPI.
Thanks
Comments
To the programmer, this does not matter, but to the connected device it matters a lot
The designer of that chip has to choose some MSB/LSB order, and, of course, they do not all choose the same - so having the option in the host avoids needing a SWAP function.
If you're shifting multiple bits at once on a parallel bus, the LSB on the lowest I/O pins can end up saving a full hub cycle. At least this is what I remember from my attempt to use eight SRAM chips in parallel.
When writing a bit banging driver in Spin, I think LSB first seems most natural to shift data out and MSB first is easiest when shifting data in.