LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Pause Trigger analog output using analog input level?

Highlighted

Hi LabVIEW Friend, 

 

I have a NI USB 6289 and I have set up an analog output which is synchronized with an analog input and start triggered by the start of the same analog input. That works fine. I would like now to pause trigger the analog output when the analog input goes below a certain threshold. For reasons of speed and elegance, I would like to use the property node DAQmx Trigger Node More/Pause/Analog Signal to set up this second trigger but I'm not succeeding in achieving what I wish... 

 

I have attached a subVI I used to test different approaches. The analog input ai0 has a DAQmx Timing (polymorphic instance: Sample Clock) set to "Continuous". The analog output ao0 has a DAQmx Timing (polymorphic instance: Sample Clock) set to "Continuous" and with source "Dev1/ai/SampleClock". This allow synchronizing ao0 to ai0. The analog output ao0 has a DAQmx Start Trigger (polymorphic instance: Start Digital Edge) with source "Dev1/ai/StartTrigger" set on "rising" edge. This allow the ao0 to start simultaneously with ai0. Then a triangular waveform (frequency 1 Hz, amplitude 10V) is downloaded on the ao0. 

 

Then I tried to set up a Pause Trigger with the the property node DAQmx Trigger Node. I have set the properties: 

More/Pause/Analog Level/Source           Dev1/ai

More/Pause/Analog Level/Pause When   Below Level

More/Pause/Analog Level/Level             -2 

 

in order to program the card to stop the signal generation on the analog output as soon as the level of the analog input goes below -2V. 

 

I have tested the program physically wiring ao0 to ai0 so to be able to see what was generated. Ideally the signal generation should stop when it reaches -2V as read by the analog input.  

 

The program acquire samples in batches until the stop button is pressed, the number of samples to acquire is reached or the signal generation is stopped. In the example subVI I have set the rate to 10 kHz and acquired 100 samples at a time. Thus the While loop runs at 100 Hz. I could check if ai0 has gone below -2V at each loop but this has the drawback that there will always be a delay (in this case of maximum 10 ms) between the physical time the ai0 has gone below the threshold and the time the program detects it.

 

If a Pause Trigger could be set on the card, the signal generation could probably be stopped much faster than it could be done using just a software check. Reducing the number of sample acquired at each time and so increasing the frequency of the while loop doesn't seem very good because the while loop is already running very fast. In my program, the Pause Trigger seems to be completely ineffective... Moreover, the analog output doesn't stop generating samples, even when the analog output task is destroyed after the while loop!!! Why this??? 

 

As side issues: if I set the property node DAQms Write Regeneration Mode to "Do not allow regeneration" I get an error -200016 "Onboard device memory underflow". If I set DAQms Write Regeneration Mode to "Allow regeneration" and I try to generate more than 2 waves I get an error -200279 "Attempted to read samples that are no longer available. The requested samples were previously available, but have since been overwritten". Why?

 

Have a luminous day and Thanks to everybody!!!

 

LucaQ

0 Kudos
Message 1 of 5
(2,804 Views)
Highlighted

Did you ever find an adequete solution to this. I'm trying to do something almost identical and am also having issues with a pause trigger. I would like to do this in hardware as I am running into the same software limitations as you did.

 

Thanks,

Dan

 

 

Message 2 of 5
(2,524 Views)
Highlighted

Hello everyone,

 

 

Thank you for posting on the NI Forums!

 

Please see the modifications in the following pictutre to the code that was attached in Luca's post:

 

trigger.png

Notice that I added a Pause.TrigType property and set it to "Analog Level." By default, this is set to "none" which is not a useful parameter for this application. Also, when triggering off of the Analog Output, it is necessary to use APFI0  instead of an analog input.

 

Please try making these changes and let me know the results.

 

Hope this helps!

 

Regards,
Margaret Barrett
National Instruments
Applications Engineer
Digital Multimeters and LCR Meters
0 Kudos
Message 3 of 5
(2,503 Views)
Highlighted
I take it that this is not possible without external electronics with a USB 6211?
0 Kudos
Message 4 of 5
(2,489 Views)
Highlighted

You are correct. The 6211 does not support analog triggering. You could aquire continuously and impose a software trigger, but that will not be inherent to the hardware.

 

Hope this helps!

 

Regards,
Margaret Barrett
National Instruments
Applications Engineer
Digital Multimeters and LCR Meters
0 Kudos
Message 5 of 5
(2,473 Views)