LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx Multiple Triggers for one generation task

Solved!
Go to solution

Hello,

 

I'm looking to find a solution or different setup for what I'm trying to do.  I have two separate external triggers that I am using for a single task that generates a waveform.  One trigger is a pulse say every 5 seconds while the other is every 1 second.  Depending on the trigger, I generate a different waveform.

One of the problems I'm having is that I occasionally miss triggers.  I am guessing it's because the two external triggers are not totally in sync.  Also, I'm using loop iterations currently to determine which trigger to pay attention to, which could end up being incorrect if I were to miss one of the trigger occurrences.

 

Is there a way to go with only the every 5 second trigger, and then use it to set up a clock/timing to generate a waveform each second until I get the next trigger?

 

Or is there a way to set the every 5 second trigger to be more of the master source, using the other trigger in-between (there will be a time every 5 seconds where both triggers will occur - without an ability to know which one will occur first)?

 

Thanks!  

0 Kudos
Message 1 of 8
(898 Views)

Sharing more details of the application and scope images or timeline of the pulses and your waveform will help get better guidance.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 8
(891 Views)

You can use a re-triggerable counter task. See Finite Retriggerable Analog Input Using LabVIEW with DAQmx

Just replace the AI with AO.

-------------------------------------------------------
Control Lead | Intelline Inc
0 Kudos
Message 3 of 8
(862 Views)

Thank you both for the replies. 

 

The example from the link could be a good start to an approach.  I made some modifications to try to better show what I'm trying to do, and have attached the VI.  I know there are some potential issues with stopping the loop and maybe where to create the notifier.  I would also probably want to drive the timed loop with hardware.


Is this something that could potentially work, or am I completely off-base?

0 Kudos
Message 4 of 8
(850 Views)

Like santhosh, I'm not at all sure I understand what you're wanting to do.  But it kinda sounds like it's more important to stay in sync with the 5 second trigger than the 1 second trigger based on the following question you had:

 


Is there a way to go with only the every 5 second trigger, and then use it to set up a clock/timing to generate a waveform each second until I get the next trigger?

If so, then do your retriggering off the 5 second trigger.  Depending on your DAQ device, this might be supported for AO directly or you may need to use ZYOng's suggestion to use a retriggerable counter task that'll generate a pulse train for the AO task to use as its sample clock.

 

Supposing you have 0.5 second worth of waveform(s) to generate each second, you'll need to create that segment (which I'll call the Active segment) along with 0.5 second worth of 0 output (which I'll call the Idle segment).   Then build up a total 4.5 second waveform by interleaving them:  Active, Idle, Active, Idle, Active, Idle, Active, Idle, Active.   If necessary, you could prepend a <0.5 second idle segment at the front if you need a delay from trigger instant until Active output.

 

Ultimately, unless you have prior knowledge of a fixed timing relationship between the 5 second and 1 second triggers, you're going to *have* to choose one that you care about most.  You might start out thinking that you want to care about both equally, but eventually you'll find that some timing sources are more equal than others.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
0 Kudos
Message 5 of 8
(802 Views)

I care about the 5 second trigger the most.

I'm trying to figure out a way to maybe use only that trigger as the basis for the timing of two things:

 

1. generate a signal every second - the 5 second trigger occurrence triggers the first of the five generations, where the subsequent four are finite generations that begin at each subsequent second after the first

2. as the determiner of which waveform to generate - the first generation is one waveform, the subsequent 4 are a different waveform

 

Then repeat this cycle.

 

Thanks to everyone for the help.

 

-Ryan

0 Kudos
Message 6 of 8
(797 Views)
Solution
Accepted by topic author rbarth

I think the approach I already outlined is going to be your simplest method.  Just define your output buffer to alternate between the bursts of "Active" waveforms and a constant Idle waveform that outputs 0 V.   This gives you full control of the content of the Active parts and the timing between them.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
Message 7 of 8
(775 Views)

Thanks a lot for the help!

0 Kudos
Message 8 of 8
(685 Views)