01-21-2016 11:42 AM
Hello, I am a beginner in LabVIEW and I have a myRIO 1900. I am trying to communicate between myRIO and Arduino via SPI and I have a few doubts
1) Using Arduino, I am trying to send data in this fashion :
for(i=1;i<=255;i++)
SPI.transfer(i);
When I send the 'i', my impression is that the value of 'i' is sent as a stream of 8 bits. Correct ?
2) How do I read this value in myRIO and make sense out of it ?
I have attached my VI that I tried to write.
What does each frame contain ? Does it contain the stream of 8 bits ?
In the SPI Read, what is Frames Read ? Frame Count ?
How do I isolate the meaningful data from there ?
How does Frame Length in SPI configure affect data transmission ?
And how do I match their clock speeds for transmission ?
01-21-2016 03:23 PM
@deepen_solanki wrote:
When I send the 'i', my impression is that the value of 'i' is sent as a stream of 8 bits. Correct ?
Did you declare the i as a byte? Or did you do some thing like init i=0;? If so then it will be sent as a 32 bit integer.
If you do read properly it will be read as the same as it was sent. I believe you get an array of bytes when you read, so if you sent it as a byte you will get an array with one element. If you sent it as an i32 then your array will have 4 bytes in it and will be the i32 you sent. Sorry I don't have any myRIO software installed so I can't test , or look at much.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
01-22-2016 11:29 AM
I will instead get to my main problem. I want to interface a 16 bit ADC to myRIO. I think the ADC is sending data but I dont know how to read it and make sense out of it. The ADC is ADS8332. Thats why I asked this basic doubt to clear all concepts.
01-25-2016 03:57 AM
@deepen_solanki wrote:
I will instead get to my main problem. I want to interface a 16 bit ADC to myRIO. I think the ADC is sending data but I dont know how to read it and make sense out of it. The ADC is ADS8332. Thats why I asked this basic doubt to clear all concepts.
Get an oscilloscope and attach it to the clock and data lines - you'll soon figure out if you're sending/receiving any SPI data. If you have a good scope, it may also do SPI decoding as part of its functionality. This is always a good starting point!