10-31-2012 01:33 PM
I have a NI X Series USB DAQ and I am trying to create a vi that will ramp an AO voltage (0-5V) until a digital edge trigger is detected. At the trigger the ramp will stop and the AO will be set to a static DC voltage. At the same time the trigger will also cause a single digital line to write HIGH. I haven’t been able to switch from the dynamic sweep to the static DC voltage or set the digital line HIGH using the trigger DAQmx.vi. Either the trigger doesn’t work, or the digital line writes high before the trigger is hit, or I’ve received errors. I’ve tried using a simple Boolean case structure instead but I am unable to interrupt the sweep until after all samples have been written. Any help?
11-01-2012 05:04 PM
Hi Andy,
I believe we can break up your application into two parts: triggering a DO task with a DI trigger, and changing the output of an AO task. For the DO task, you can select a PFI line as the digital trigger source, and select either a rising or a falling edge. There is an example of triggering an AO task on a digital line, it's called Voltage - Finite Output.vi.
For the analog output task, you can monitor either the trigger line or the DO line, and when either of those changes, you would change what you are writing to the AO DAQmx Write VI. If you output one sample at a time, you won't have to wait for the ramp pattern to finish before you switch to the static DC output. The important thing here is that you can't generate an entire ramp pattern and write it, because DAQmx won't move on until everything has been moved to the card's memory. Instead, write only a little data at a time.
Check out these examples for some ideas:
https://decibel.ni.com/content/docs/DOC-9936
https://decibel.ni.com/content/docs/DOC-14582
Regards,
Alexandra Valiton
Applications Engineer
National Instruments