LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I trigger an event using a DAQmx device?

Hello,

I'm currently using a NI USB-6000 to acquire an analog signal in form of a triangle wave. Now I want to know if there is a possibility to trigger an event in my VI using the extremes of the signal. I'm thinking of a while loop that waits, until a maximum or minimum is reached.

I know that there are DAQmx functions to trigger the data acquisition but I don't know if I could use them to trigger something else.

I would be very thankful for some advises!

0 Kudos
Message 1 of 6
(4,593 Views)

Wiring the DAQmx Task into a 'Register for Events' node (such as is used to create the dynamic events for an Event Structure) allows you to trigger events on certain criteria. However, I'm not sure that you'll be able to do with with a USB-6000. A link describing the idea is here: http://www.ni.com/tutorial/4102/en/

 

For the analog signal you're describing, you might be able to use an Analog Edge to trigger your acquisition, and just acquire a small number (perhaps 1?) of points, and use the DAQmx Event with 'Sample Complete' to trigger an event structure when the acquisition completes, but I'm not sure how easy it would be to retrigger, and how you'd go about having two edges (or distinguishing them). If you could use two analog inputs, both of those problems would disappear (but you lose an input).

aivoltageToDAQmxEvent.png

 


GCentral
Message 2 of 6
(4,559 Views)

With using two analog inputs you mean that with the first input I trigger on the maximum and with the second on the minimum? And for retriggering I have to stop the task and set it up again every time? This sounds not very efficient to me... I also have the possibility to create an TTL signal from the triangle wave and could use this as a digital trigger, would this be any better to trigger, repeatable?

One more note... I don't have to trigger an event on every max and min. The VI waits for "command" --> trigger event on next max --> trigger another event on following min --> VI waits again for "command" -->...

0 Kudos
Message 3 of 6
(4,545 Views)

With two inputs, yes, that's what I meant. I agree, not the nicest solution! Regarding retriggering, I'm not certain - it might be that just using 'Start' in the event case (or immediately preceeding/following the sending of your command) would be sufficient to reset it (I don't know).

 

If you have a TTL signal, you'd have a much easier time. In that case, you should see if your hardware can use the 'Change Detection' event on the DAQmx Event, wiring a Digital Input (rather than Analog Input, as shown in my first reply) and changing the enum constant to 'Change Detection'. This should presumably run every change, and so no extra code would be needed as far as I know to get it to repeat as you want (unless you have far too many max/min cycles, in which case you'd need to work out if you should ignore them!)


GCentral
0 Kudos
Message 4 of 6
(4,534 Views)

Hi,

 

with your cheap USB6000 you can use the PFI inputs to count pulses and as start trigger - nothing less, nothing more.

 

Maybe you should buy hardware suitable to your requirements?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 6
(4,530 Views)
Yeah I only have the cheap USB6000... what would be suitable hardware? Anyways, I have to work with the USB6000 now... maybe I should just do the direct way and acquire data continuously, 1 sample and compare values to get the max and min.. I even know the frequency, amplitude and offset of the triangle wave so the sample rate doesn't have to be that high and I can "predict" the max an min values. maybe this is precise enough... I have to try it.
0 Kudos
Message 6 of 6
(4,514 Views)