Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Arduino timeout using LINX

I created a VI which controls an Arduino MEGA 2560 using LINX. The program goes through a series of steps using a state machine architecture (see attached VI).   

My problem is that the program executes one cycle without any problems, but I get an error (5501: timeout occurred at the actuator forward/backward stage) when the cycle restarts. I figured out that replacing the “Analog Read N Chan” command with a constant eliminates this problem, but I can’t figure out why having it in the code is causing the above-mentioned issue. Any advice would be greatly appreciated.

0 Kudos
Message 1 of 3
(3,783 Views)
did you use any wait like(200ms) inside your loop
0 Kudos
Message 2 of 3
(3,760 Views)

Hi gjstat01,

 

I agree with Hatef.fouladi that adding a wait before your read might help. Without knowing too much about your setup, the error just seems to indicate that the timeout is occuring because the read function is not actually receiving any data. I would try to create a simplified VI where you write the same data to the device that precedes your "Analog Read" case and then try to do your “Analog Read N Chan” and see what happens.

Mark M.
Applications Engineering
National Instruments
0 Kudos
Message 3 of 3
(3,744 Views)