LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem SPI / LIFA

Hello,

I now work for 1-2 weeks but there is no solution for my problem.

I had bought a digital encoder for the angular measurement of a robot arm.

http://docs-europe.electrocomponents.com/webdocs/12af/0900766b812af498.pdf

I have connected the PINS according to owners manual to the Arduino MEGA 2560 board. But the output ist always Zero.

PIN1 Digital Input -> Ground

PIN2 Clock -> SCK Arduino PIN 52

PIN3 Ground -> Ground

PIN 4 Digital Output -> MISO

PIN 5 VCC -> 5V

PIN 6 CS -> SS Slave

Can anyone help me with the program?

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

Are you sure the device will work using SPI?

Also, there are several of the VI's that you shouldn't be using in the while loop including "Pin Mode" and all of the SPI configuration and Init VIs.  The Init VI should be after your configure the SPI port also.

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

hello nathan,

First of all thank you for the fast reply.

I 'm not sure if the encoder outputs really SPI .

In the notes I send a photo from a functioned C code that works in the Arduino program . Can someone help me put this code into a .vi Code.JPG

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

That code doesn't use SPI so you should not expect SPI to work. You would

need to create a new custom function to implement that code to have it

return the raw data to LabVIEW where you would interpret it there.

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