Skip to main content
Cbalt.1
Associate II
December 28, 2021
Question

SPI write 8 bit to 16 bit

  • December 28, 2021
  • 2 replies
  • 2423 views

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.

This topic has been closed for replies.

2 replies

Cristian Gyorgy
Associate II
December 30, 2021

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
Cbalt.1Author
Associate II
January 1, 2022

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.