LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

USB 8451-how to set a chip select value

I need some help on USB-8451 SPI programming using LabVIEW. On the USB-8451 device, there are 8 physical chip select (CS) lines. I will need to program or use all of these CS lines to select one of the 13 SPI slave chips on the circuit board. I know I will have to use the SPI Configuration Property Node to program CS state. What value should I use to set the CS property if need the following CS line states to select one of our chips?

CS0 = 1; CS1 = 0; CS2 = 0; CS3 = 1; CS4 = 1; CS5 = 0; CS6 = 1; CS7 = 0

Thanks, Min.

0 Kudos
Message 1 of 6
(4,074 Views)

Hi Min,

The SPI API only allows to set a specific CS line at a time. Each value of CS0, CS1, etc will have to be set individually. You can use the advanced API to set multiple lines or a better method would be to use the DIO lines to write a 8 bit pattern to correctly set the chip select lines.

I hope this helps you get started!

Chris R.
Applications Engineer
National Instruments
Message 2 of 6
(4,061 Views)

Hi Chris,

I tried your example of set each CS line individually via a script from the advance API.  But after I ran the script, all the CS pins are in their tristates.  I then read the function help for SPI Script Disable SPI.vi.  This function call stristates all CS pins.  Do I really need to call the "SPI Script Diable SPI.vi" before calling the "SPI Script Run Script.vi"?What can I do to make all CS pins to function like those DIO pins in the push-pull states.

Thanks,

Min.

0 Kudos
Message 3 of 6
(4,018 Views)
The Script enable and Disable commands start and stop the script recording and the RUN Script should run the recorded script then.
Thus if you set the CS Lines within the script, they should be set when the sript runs.

DirkW
0 Kudos
Message 4 of 6
(4,003 Views)
FYI: VI referenced is attached.
Chris R.
Applications Engineer
National Instruments
0 Kudos
Message 5 of 6
(3,960 Views)

Hi Chris,

I have got everything working on the device.  Thanks for your help.  To resolve the tristate issue, I simply remove the "SPI Script Diable SPI.vi" call and I run a script with the disable SPI call just before I exit the program.

Regards, Min.

0 Kudos
Message 6 of 6
(3,948 Views)