LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with DAQmx voltage readings.

Attached below are the 2 programs we are trying to integrate. The main program will record video on an 11 second loop. Currently the loop stops recording the video when the stop button is pressed and saves the avi file to the desktop. The other program will actively monitor a voltage source and report the voltage until the stop button is pressed. What I want to do is have the main program stop the loop when the voltage goes higher than 5 volts. I know that I can set that part up with a comparator to stop, and that is easy. 

 

I am currently having problems getting the two programs meshed together. When I try to do it, I can either get the video to record and not update the voltage real time, or to update the voltage real time but not record the video. I can't figure out where to place the parts of the voltage reading program into the main program so that it works the way I want. 

 

Any help will be greatly appreciated.

 

Thanks

Download All
0 Kudos
Message 1 of 11
(3,586 Views)
bump
0 Kudos
Message 2 of 11
(3,553 Views)

try and put the code from "read voltage.vi" into "grab and record final.vi" and check the voltage everytime the loop checks to see if the stop button was pressed and then use an OR to decide whether or not to stop.

 

hopefully this helps 

0 Kudos
Message 3 of 11
(3,545 Views)
I tried to do what i said but im not sure what some of the subVIs are so i think this should work if voltage gets above 5V or either stop button is pressed or there is an error
0 Kudos
Message 4 of 11
(3,542 Views)

I have tried what you posted. It doesn't appear to read the voltage data in real time.

 

Also after the first 11 seconds the program crashes saying that an error occured at the DAQmx read vi and that it is attempting to read samples that are no longer available.

 

Any ideas?  I need the voltage to read real time so that the video stops the instant that 5 volts is detected.

0 Kudos
Message 5 of 11
(3,527 Views)
Why don't you simply put the DAQ code in a separate loop. Just copy everything in the Read Voltage VI and paste it outside your other loop. Quickest way for you to get both to work together is writing to a local variable in the DAQ loop and reading it in the IMAQ loop.
0 Kudos
Message 6 of 11
(3,520 Views)
Seems like I tried that and it didn't record video at all.
0 Kudos
Message 7 of 11
(3,515 Views)
Yea whenever I try to include the voltage data from the data read loop to the inner loop of the video part the video won't record until the voltage reading is stopped ie I push the stop button for the voltage read loop.
0 Kudos
Message 8 of 11
(3,511 Views)
I did NOT say to do that. I said OUTSIDE the video loop. You put the DAQ loop completely outside any code you have in the video program. This is two loops and parallel and is a basic, basic feature of LabVIEW.
0 Kudos
Message 9 of 11
(3,497 Views)

I made two parallel loops. I am just trying to use the voltage data from the read loop to end the video record loop. I have kept them parallel. With the parallel loops I can get the voltage to update real time, and at the same time I can get the video to record. However, they each have their own respective stop buttons. I want the voltage data to be able to stop the video recording and its not working. The voltage will read real time, but the video will not record until I hit the stop button for the voltage reading.

0 Kudos
Message 10 of 11
(3,456 Views)