04-01-2013 02:07 PM
I am currently developing a program using LabView 2012 SP1. I am interfacing with a NI USB-6009 DAQ using NI-DAQmx 9.5.5f4. I am attempting to acquire a voltage reading on three analog inputs (AI0, AI3, and AI4) at 1 second from startup and at 20 seconds from startup. The three digital ports: P0.0, P0.1 and P0.2 are used to turn on transistors for the signals in question and must remain high during the ~20 seconds the readings will take place. After the ~20 seconds I need to take the readings from each analog channel and take the difference of the two to determine the delta at startup. This delta will drive logic to be implemented later. The attached VI has a while loop which runs on a 1 second interval and a case statement that takes a DAQ reading at 1 second and 20 seconds (two separate cases). The while loop terminates after 21 seconds. The issue I am having is how to handle the read voltages from the 1 second case and the 20 second case. I need to take the difference and output to the front panel after the 20 seconds has elapsed. Please keep in mind when you respond that I am relatively new to LabView. I have experience with various other languages (Matlab scripting, C, Java, Perl etc..) but am still learning how to get things done in LabView. That being said, assume I know nothing outside of what you see in this VI. If you have recommendations on how to implement this more efficiently, I am open to suggestions. Thank you in advance for your help.
RJ
Solved! Go to Solution.
04-01-2013 02:16 PM
I would acquire 21 seconds worth of data from the DAQ. You can then index out the specific samples you want. Having the hardwire time the samples is a lot more reliable than hoping Windows will time the 21 seconds correctly. It also simplifies the code by quite a bit.
04-01-2013 02:20 PM
Ok, so I assume based on a sampling frequency the daq will continuously read for 20 seconds and dump each sample into an array indexed on the sampling frequency? That sounds like a much better plan. Do you have any examples you can point me to? Thank you for the reply.
04-01-2013 02:23 PM
Use the LabVIEW Example Finder (Help->Find Examples) and do a search for Analog Input or something like that. There's plenty of good examples in there.