11-23-2022 01:30 PM
--> This post is about SPI and communicating to by sending 16bits
I am trying to communicate with an SPI channel that needs to receive 16bits as opposed to 8bits.
Is this possible to do with the NI8452?
Is it possible to do with the sample subVIs that come with Labview, specifically subVI: NI-845x SPI Write Read.vi?
Is there a Write Read vi for 16bits?
The sample VI in Labview is "NI-845x SPI Write Read.vi", it has an input for the can be changed to u16 (It is a u8 to start with) this in turn goes into a Call Library Function Node that coerces the input into a 8bits. In other words, the DLL is looking for an 8bit string of data.
A solution that didn't quite work was to take the 16bit data and divide it into two 8 bits, sending it as two bytes but this did not work.
Thanks for any help,
Jorge Vega
11-23-2022 09:44 PM - edited 11-23-2022 09:45 PM
To write or read n bits, you need to split them into U8 values, this is clearly explained in the help for the API as shown below.
Note: don't forget to configure the "Number of Bits Per Sample" property to tell SPI how many bits are part of a packet.