AAvedro
2008-06-23 12:40:08 UTC
I'm trying to control a stepper motor by: 1) using Analog inputs switching between 5 (ON) and then 0 (OFF) Volts to move it and then 2) acquiring Voltage inputs right afterwards through my IOtech PersonalDaq3001. I've included a copy of the VI I am working on. I've spoken to an IOtech representative and he said that I have to use their READ SCAN sub-vi in a While loop that encases my entire program. The READ SCAN sub-vi should effectively acquire data all the time while the program is running. From there, I should have a For loop to toggle the motor 'X' number of times and pick off data points from the READ SCAN array in order to get the current Voltage value after each toggle.
Also, I'm trying to sample 100 points each time so I can get an average Voltage value instead of a single value and then storing that into an array which I want access to after the completion of the For loop.
When I run the VI now, the For loop actually runs X number of times before it re-enters the While loops. So for the 1st iteration, it runs once (gets data once and moves motor once). For the 2nd iteration, it runs twice (get data once, moves motor once, grabs the SAME data again, and moves the motor
again) before re-entering the While loop. I'm not sure why it grabs the same data and why it grabs it X number of times.
So in summary, I'm trying to have my program to toggle my motor (switching between 5 and 0 V), acquire an average voltage reading, and then store that value into an array. I want to toggle the motor X number of times and have a voltage value read after each toggle with each voltage value coming from the Read SCAN sub-vi. I've tried programming this but have been unsuccessful.
Also, I'm trying to sample 100 points each time so I can get an average Voltage value instead of a single value and then storing that into an array which I want access to after the completion of the For loop.
When I run the VI now, the For loop actually runs X number of times before it re-enters the While loops. So for the 1st iteration, it runs once (gets data once and moves motor once). For the 2nd iteration, it runs twice (get data once, moves motor once, grabs the SAME data again, and moves the motor
again) before re-entering the While loop. I'm not sure why it grabs the same data and why it grabs it X number of times.
So in summary, I'm trying to have my program to toggle my motor (switching between 5 and 0 V), acquire an average voltage reading, and then store that value into an array. I want to toggle the motor X number of times and have a voltage value read after each toggle with each voltage value coming from the Read SCAN sub-vi. I've tried programming this but have been unsuccessful.