Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

synchronize AI and counter output

i am trying to synchronize a finite pulse train generation (on counter 0) with data acquisation on AI. When the counter starts to generate the pulse train, the analog input should start at the same time. I am using a pxi6071e. which VI´s should i use to do this. has anyone a hint for me?
0 Kudos
Message 1 of 4
(3,444 Views)
There's a couple options Rettenbacher, depending on your synchronization needs. One would be to use the pulse train output as a digital start trigger for your AI. The other would be to use the pulse train as the sampling clock for AI. Either way, you would start the AI before the CTR task so it'll be "ready" when the actual pulses start coming.

Here's a screenshot that shows some of the basics of each. Note: this isn't ready-to-run -- several potentially important inputs have been left out (finite vs continuous AI sampling, trigger polarity, etc.). But hopefully it'll get you started.

-Kevin P.
CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 2 of 4
(3,437 Views)
Hi,
I have a similar application about which I would appreciate some expert advice. I am running with a PCI-6071E, SCB-100 and Labview 7.0.

I am opening and closing a pressurized chamber gate to let out a puff of air, using a step motor. I control the motor by sending out a pulse train on the GPCTR1_OUT pin, using the 'Generate Pulse Train' vi. Setting the pulse frequency lets me specify the motor speed and setting # pulses specifies distance the gate moves. Direction the motor turns is specified with a hi/lo signal out of a DIO pin. I use a 3-frame sequence to 1)open gate 2)wait a variable time 3)close gate.

I wish to acquire flow data about the air puff from a transducer into an AI pin. Ideally, the gate motion should be synchronized with AI, so that DAQ starts when the gate-opening pulse train is sent. Then after the gate closes, the AI should continue for a while (don't really care how long, manually stopping with a stop button is fine). I'm not familiar with DAQmx aside from trying to figure out the example above with help notes. Does that example make AI end when the pulse train ends? Is it possible to have the two tasks start synchronized, and have the AI continue on after the finite pulse train generation has ended?

Any help would be much appreciated,
Will.
0 Kudos
Message 3 of 4
(3,404 Views)
Hi Will,

I'm at a network workstation w/o LabVIEW so I can't show an example right now. The earlier code picture I posted showed two alternate methods for sync'ing a counter pulsetrain with AI. The top section generates the pulsetrain, the middle section shows a method where one AI sample is taken for each pulse, and the lower section is the method where the first pulse triggers the AI to start sampling at the rate and duration you choose. The lower section sounds like what you'd need. You would just put those 2 lower vi's in place of the Sample Clock one in the middle.

There's a way to be able to stop and re-start a triggered AI under DAQmx without clearing and re-configuring the entire task. I *think* you have to use one of the more advanced DAQmx Task control vi's to either 'reserve' or 'commit' the task before you 'DAQmx Start' it. Then when you 'DAQmx Stop' the task, you can quickly 'DAQmx Start' it again without any further configuring. As I recall, only one of those options will actually work. Or maybe one was just a lot faster.

Anyway the point of all that is to alert you to methods that will get you ready for the next triggered AI acq as soon as possible after finishing the previous one. Even if you don't need to worry about it for this app, the day will come...

-Kevin P.
CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 4 of 4
(3,390 Views)