cancel
Showing results for 
Search instead for 
Did you mean: 

SPI write 8 bit to 16 bit

Cbalt.1
Associate II

Hello everyone, I am newbie, I want to use spi connection STM8 master with slave 16 bit IC. I have to write 16bit register to set the IC. How could I send 16 bit value to IC to set it with STM8, may you share some codes? best regards.

2 REPLIES 2
Cristian Gyorgy
Senior III

Hi!

16 bit = 2 x 8 bit. Very simple,

If you would need to write a 32-bit value to some SPI slave, you would also just sent 4 bytes. That's it!

Cbalt.1
Associate II

Hello Cristian,

Thanks alot to answer me. Actually , I realized that I have already passed issue after buying logic analyzer. Our actual problem was reading, I mean ;

there are 32 bit register for reading

8 bit adress-16 bit data-8 bit command (last 8 of 4 bit is CRC ). So , I am very confused , to read the register with data.

May you give to me little code snapping please?

Best regards.