09-22-2023 10:50 AM
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!
Solved! Go to Solution.
09-22-2023 11:12 AM
Sharing more details of the application and scope images or timeline of the pulses and your waveform will help get better guidance.
09-22-2023 12:39 PM
You can use a re-triggerable counter task. See Finite Retriggerable Analog Input Using LabVIEW with DAQmx
Just replace the AI with AO.
09-22-2023 03:20 PM
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?
09-23-2023 03:09 PM
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
09-23-2023 03:27 PM
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
09-24-2023 04:06 AM
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
10-16-2023 03:19 PM
Thanks a lot for the help!