LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do i read and write a string through the SPI bus?

I am using a USB-8451 SPI interface. I have been using the built in VI's to communicate with the processor to send and receive numeric values. Is there any way to communicate through the SPI using strings and input and output values?
0 Kudos
Message 1 of 6
(3,801 Views)
This should do the trick :



The name of the picture comes from a VI of another thread and has no link with your question... I can't change it now.



Message Edité par JB le 07-21-2008 05:11 PM
0 Kudos
Message 2 of 6
(3,799 Views)
Thanks. The code on my processor actually expects to receive a string and will give me a string in response. It will not work if i change it to a number. Are there any other vi's that will allow me to deal exclusively with strings? Is there any way that i can modify the existing vi's to make them work with just strings?
0 Kudos
Message 3 of 6
(3,793 Views)
Above example will send the ASCII codes of the characters (eg : ABC --> 0x41 0x42 0x43). What is expected by the processor ?
0 Kudos
Message 4 of 6
(3,786 Views)
The code on the processor is expecting to see strings such as "LCD_TEST" or "KEYPAD_TEST" in order to run the various subroutines coded on the chip.
0 Kudos
Message 5 of 6
(3,783 Views)
SPI transmits bytes. That's the first thing you need to understand. A string is represented as a sequence of bytes in which each byte is the ASCII codes of a character in the string. Thus, the conversion of a string to a byte array as shown in the example will give you the array of ASCII codes that you then transmit over the SPI interface. The processor should be able to interpret the array of bytes (ASCII codes) as the string. Did you write the code on the processor?
0 Kudos
Message 6 of 6
(3,754 Views)