LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

analog input voltage and counter input frequency simultaneously

Hello, Guys,

 

My problem is kind of tricky, I need to acquire two channels of signal SiMuLtAnEoUsLy. One is a arbitrary (1 - 3 volts) and another is a square wave we were talking about. For the first channel I just need to acquire the voltages. For the second channel, I need to capture the period/frequency of each pulses and record it at the end of each pulses. So I prefer to use the
"pulse measurement" vi and "analog input - voltage" to initialize the DAQmx instead of  CI Pulse Width DAQmx call (because this call use "CI" to initialize the DAQmx, I am afraid that will not allow me to acquire the two channels simultaneously).

 

Please let me know what you guys think about this issue, thanks 🙂

0 Kudos
Message 1 of 4
(3,773 Views)

Hello,

 

Try taking a look at this example, I believe it may be able to achieve your requirements (AI with CI Frequency) but it is a very specific case and the way it works may be undesirable for your application.

 

The other way would be to reference the AI Start Trigger flag as the Start Trigger on your CI task, and start your CI task before you start your AI task.  When your AI task starts, the flag is asserted high, and thus initates the start trigger for the CI task.  Both tasks can be ran simultaneously in the same VI no problem. 

Kyle A.
National Instruments
Senior Applications Engineer
0 Kudos
Message 2 of 4
(3,757 Views)

Hello, Kyle,

 

Thank you for your attention, really appreciate that.

 

Since I am not a DAQ people, my question may sound quite simple. As you suggested, I just use the "Start Trigger" by "Digital Edge" to trigger the analog input voltage acquisition, source of the trigger is "/Dev3/PFI4". Both AI and CI are acquiring data, but not in a simultaneous manner. Would you help me out? Would you let me know how AI and CI can stop acquiring at the same time as well?

0 Kudos
Message 3 of 4
(3,734 Views)

Hello,

 

First, you need to have your start trigger on your Counter Task, because you need to trigger off the aiStartTrigger flag sent out from your Analog Input task starting.  Your error wires should force your Counter task to begin first, but since it is waiting on a trigger, you will not begin acquiring until your analog input begins.  The source of your trigger is the aiStartTrigger flag, and you may have to right click your control and select I/O Name Filtering and check the internal signals box. 

 

Also, your error wires are not connected right, as it needs to be a link between all VI's that are unbroken.  You'll need to wire the error from your AI start task to your read functions, and then out of one read function to your clear tasks.  You do not need to split the error wires up at any time. 

 

Your CI and AI tasks are only happening once, so you will only read one period and one subset of samples.  If those samples/period do not happen within the specified time out, you will get an error. 

Kyle A.
National Instruments
Senior Applications Engineer
0 Kudos
Message 4 of 4
(3,717 Views)