From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SPI communication with Arduino Uno

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 ?

 

0 Kudos
Message 1 of 4
(3,851 Views)

@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.

0 Kudos
Message 2 of 4
(3,818 Views)

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. 

0 Kudos
Message 3 of 4
(3,787 Views)

@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!


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 4 of 4
(3,732 Views)