LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-8451 SPI Advanced Programming Model

Hello,
 
   The Ni-8451 appears to output data on the SPI port in groups of 8 (1 byte) worht of data. The NI-8451 SPI advanced programming model appears to allow the user to output data without having gaps between the bytes, has anyone verified this? Can the NI-8451 SPI Advanced programming model be used to output a quantity of bits that is not a integer multiple of bytes? Suppose I want to output 26 bits, Can I do that?
 
Have a great day!
 
Kaspar
Regards,


Kaspar
0 Kudos
Message 1 of 4
(2,779 Views)

Hi Kaspar,

Just to clarify, are you looking at the NI-845X SPI Script Write Read.vi under the SPI Advanced palette?  The data type input here is an array of U8's (bytes), so it does not look you would be able to write out bits that aren't in the byte format (half-bytes without having zeros appended & so on..)  You may also find this knowledgebase article on whether the USB-8451 Supports 16-bit Transfers.  Hope this helps!


Regards,
Anna M.
National Instruments
0 Kudos
Message 2 of 4
(2,756 Views)

Hello,

 

  Thanks for the response to my question. I am able to send multiple bytes to a SPI device by simply building a byte array with all of the bytes that the SPI device requires. I need to understand how to read multiple bytes back from a SPI device . Do you know what determines how many bytes to read from a SPI device?

Regards

Regards,


Kaspar
0 Kudos
Message 3 of 4
(2,747 Views)

Hi Kaspar,

The technique to read multiple bytes from an SPI device may vary from device to device, so I would recommend referencing your device manual first.  However, for the SPI Example programs included with the I2C/SPI driver with LabVIEW, you first specify the address that you want to read from, and then you specify an array of X empty bytes.  Starting at the specified address, the SPI device will shift out X bytes to be read into your program.  The examples for Basic and Advanced SPI programming have been commented to describe each step in the process, so they might be a good reference for you.  You can find them under Help>>Find Examples... and then looking under Hardware Input and Output>>I2C and SPI.  Hope this helps!


Regards,
Anna M.
National Instruments
0 Kudos
Message 4 of 4
(2,732 Views)