From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I abort an analog output whenever a retrigger is activated

Hello,

 

I'm attempting to create a true retriggerable analog output using an analog input signal on daqmx. I'm using a USB-6351 X-series on Labview 2011.

 

I've successfully created a typical retriggerable analog output system which uses an analog input trigger. This analog outputs 2 different custom 1D waveforms (see attached vi). Each time the trigger occurs (once enetering the window and once leaving the window) the waveform which is being outputted changes. This program works perfectly until i try and retrigger the task while a waveform is in the middle of being outputted.

 

My situation involves a fluctating analog input signal which may, or may not occur in the middle of the waveform being outputted. Based on what i've found, the retrigger will not work while the task is running and i need to find a way around this.

 

Is there a way to abort the analog output whenever a trigger is activated on daqmx? My plan is abort the current analog output and then reset the task to start outputting a new waveform. I just can't seem to figure out how to abort my task with a retrigger.

 

Ideally, what i would like is the ability to simply switch which waveform is being generated upon entering and leaving the trigger window despite if the waveform is in the middle of being outputted. If anyone knows an easy way to do this, please let me know.

 

Thanks

 

0 Kudos
Message 1 of 6
(4,087 Views)

Hello clmcinto,

 

What I would recommend for you , if I understood your applications, is to use the acquisition as a condition to a case structure or a select to define which waveform you are going to generate on your output task. Make sure to have the DAQmx write inside the while loop ofr your analog output task.

 

Regards,

Jose R
0 Kudos
Message 2 of 6
(4,056 Views)

Hello,

 

That was my original idea as well. My original  vi used an analog input task and connected this task to a case structure. This case structure then controlled which waveform was being outputted. The problem I had is that my vi was very long and complicated. I later found the retriggerable task and found it much easier to use that. Additionally, this original idea never solved the problem of stopping an analog output task in the middle of the task. 

 

I'm attempting to create something very similar to http://www.ni.com/white-paper/9384/en/ except with an analog trigger instead of a digital.

 

I've left the DAQmx write outside of the while loop because I only want the waveform to be performed once when a retrigger is activated.

 

Below is an example of what I want.

Untitled.png

 

Untitled1.png

0 Kudos
Message 3 of 6
(4,034 Views)

Hello clmcinto,

 

 

As I understood from your VI, you are building a buffer that includes both waveforms. I would like to know what output are you obtaining from the output when you stop the application while the waveform is getting generated. Can you share a screenshot of this output?

Jose R
0 Kudos
Message 4 of 6
(3,988 Views)

Hey toto11

 

I think this is a screenshot of what you wanted. I ran the application and hit the stop button (stopping any analog output generation) part way through waveform generation. I hit the abort execution button roughly 1 sec later to stop the analog input readings.

 

Untitled2.png

 

Thanks,

Cory

0 Kudos
Message 5 of 6
(3,984 Views)

@clmcinto wrote:

 

Is there a way to abort the analog output whenever a trigger is activated on daqmx? 

 


Unfortunately, no.  You can use a pause trigger to stop the output immediately but you can't immediately switch to the new waveform using hardware-timing.

 

I think the most straightforward would be to use an external MUX to switch between two analog outputs depending on whether or not your analog input is within the desired range (the "analog comparison event" can be routed to a PFI line to control the external MUX).

 

 

Best Regards,

John Passiak
0 Kudos
Message 6 of 6
(3,980 Views)