LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

passing data between case statements and general timing issues using daq

Solved!
Go to solution

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 

I surf therefore I am....
0 Kudos
Message 1 of 4
(2,282 Views)
Solution
Accepted by topic author surferEE

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 4
(2,275 Views)

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.

I surf therefore I am....
0 Kudos
Message 3 of 4
(2,273 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 4
(2,268 Views)