08-11-2019 06:44 PM
This one has me stumped. I've done many triggered AIs, but never an AO quite like this.
I have a counter output wired to PFI0. I wrote a little state machine to adjust the counter output so I can modulate frequency and the duty cycle. I need the duty cycle control so the off delay is long enough to stabilize the output signal that the analog output triggers.
So the little program attached works, but the output inverts only every few clocks of the counter, and it's never periodic. It's random like the analog out trigger isn't catching all the rising edges.
I need the Analog out to flip polarity on the rising edge (5V out, then -5V, etc.). Something else is triggered on the falling edge (hence the need for control of the duty cycle).
Any ideas? I've tried this on a PCI-6259 and a USB DAQ (forget the model but it's one of the higher end ones).
Thanks in advance. This is LabVIEW 2018 BTW.
Solved! Go to Solution.
08-12-2019 03:55 PM
Correct me if I'm wrong, but it sounds like you just want an analog output to toggle between 5 and - 5 V on every rising edge of a sample clock, right?
If so, just make a normal continuous output AO task. Set the sample clock to be your counter's output (PFI0 or the internal output if you want to get fancy). Don't use a trigger VI at all on this task. Write only two samples (+5 and -5) to the AO buffer, and then start the task. The buffer will automatically be circular, so you never have to write again. Just let the task play out until you exit your main counter loop, and then clear the AO task.
08-12-2019 09:39 PM
I have a the counter internally routed to PFI0. All I had to do to solve it was to loop a "Task Done?" function so the AO task catches the edges.
Your method sounds interesting, I'll try it. Everything is tied to the rising and falling edges of the counter, so it makes sense to use that as the clock.
Thanks for the insight.
08-14-2019 07:26 AM
Your method works perfectly and is much more elegant and easy to terminate. Just used a notifier to end task when the main loop is terminated. AO sets output to 0V they at the end and all is good. Thanks for the tip!
08-14-2019 08:09 AM
Glad to hear it! Please mark the solution post as correct so the thread appears solved on the main forum page 🙂