11-24-2014 07:05 PM
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
11-26-2014 01:53 PM
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,
11-27-2014 12:36 PM
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.
12-01-2014 03:46 PM
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?
12-01-2014 04:28 PM
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.
Thanks,
Cory
12-01-2014 04:39 PM
@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,