LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stepper Motor Randomly Turns Further than Commanded

I am using a set of 6 Anaheim Automation DPN10601's to control 6 different stepper motors. When running my experiments, I feed the command to move X steps, pause then command the motor to move X steps again. It will work N times, but on the N+1 time, it will turn a random amount, sometimes 10 or more times what it should have. I attached my code for reference.

 

I will note that my box tells me I have a "Range Error," but when I send the exact same commands via direct talk using Tera Term, I do not get an error light.

 

I am going crazy trying to fix this!

0 Kudos
Message 1 of 2
(1,984 Views)

Hi WildCat,

 

I am going crazy trying to fix this!

I can understand that after noticing all those race conditions in your subVIs, especially in the DPD75601_original.vi!

Get rid of those race conditions and use more wire instead of local variables and "value" property nodes!

(This seems to apply to all your VIs: way too much locals and sequence structures!)

Edit: found more problems like

- initializing a serial port in parallel with a serial port write function. (Just another kind of race condition…)

- setting up DAQmx tasks without clearing them

- comparing floats for equality (like "== 0.1")

 

General suggestion for such problems: it helps to implement a debug logging algorithm! You could write all commands send over the COM port to a text file (with a timestamp) to check for malformed commands…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 2
(1,951 Views)