LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read voltage continuously in attached program

In the attached program, I want the data aquisition to start when the program starts (which it currently does). The picture box needs to start moving when the input voltage is greater than 2V (this is in frame #2 of the sequence) and then the program needs to stop completely when the voltage drops back to below 2V. Thus the program needs to read the input voltage for the duration of the program. (The voltage starts at 0V and then jumps to ~3V which is when the box should move and then goes back to 0V at which point the program should stop.)
I would like to keep the guts of the program the same (the stacked sequence part) if possible. Could I put the data acquisition part in a seperate loop?
 
Thank you!
0 Kudos
Message 1 of 2
(2,159 Views)
Hello chip007,
 
I looked at your code and you will have to have a seperate while loop that continuously acquires data. The reason why you have to do is because if you change your while loop in the 2nd frame to run continuously, then the LabVIEW compiler would not reach the 3rd frame unless the while loop stops.
 
So, in the current code, once labview reaches the 2nd frame, it will move only move onto the next sequence when the while loops stops, i.e. voltage reaches 2V.
Also, I noticed that you have put the DAQmx Create Task inside the while loop. You would need to have this outside the while loop and only have to DAQmx Read inside the while loop. Also its a good practice to stop or clear a task once you are done with it. Refer to some examples available through the Example finder (Help >> Find Examples) for more information on using the DAQmx VIs. Also this, is a good source of information.
 
Regards,
Chetan K.
Application Engineering
NI
0 Kudos
Message 2 of 2
(2,134 Views)