16 bit SPI device with an 8 bit microcontroller...
well wisher
Posts: 4
Hi all,
Is it possible to interface a 16 bit SPI device with an 8 bit microcontroller..?(16 bit SPI device in the sense it's registers are of 16 bit.)
Is it possible to interface a 16 bit SPI device with an 8 bit microcontroller..?(16 bit SPI device in the sense it's registers are of 16 bit.)
Comments
Unless your 8 bit micro is very unusual, yes, this is just a matter of sending two bytes, and after Byte1 is send, you save the SPI reply, before sending Byte2, and now you merge the two replies.
That means 16 bit data can be send as two 8 bit data.Am I correct?If yes,then which one to be send first MSB or LSB? (I am using a PIC16f873 controller.)
Yes, you send as 2 x 8 bit bytes.
Which one is MSB, depends on the SPI slave, as usually you have more choices in the uC registers, so the slave sets the 'convention'.
Check the slave info, to see what order it wants the bits fed, and then setup the uC registers to do that.
In extreme cases if the bit order cannot be chosen in a register, you sometimes have to add software for byte-reversal (swaps the order of the bits )
I will try.