Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog output still active after quitting program

Solved!
Go to solution

I'm running the VoltUpdate.prj example to output a constant voltage level on a PXI-6723.  It works as expected, except when I quit the program, the output is still active at the lsat voltage setting.  I tried the code in a project of my own (without all the UI code, just DAQmx) and the same thing is happening.  This is happening despite calls to StopTask() and ClearTask().  I wouldn't think you would need to stop or clear the task prior to closing the program, anyway.  It should stop any measurement/generation when the program ends.  Anyone know what's going on here?

 

Edit to include some code:

 

	float64 data = 1.756;
	DAQmxErrChk (DAQmxCreateTask("Voltage Out", &myTask));
	DAQmxErrChk (DAQmxCreateAOVoltageChan(myTask,"Analog/ao0","",-9.0,9.0,DAQmx_Val_Volts,""));
	DAQmxErrChk (DAQmxStartTask(myTask));
	DAQmxErrChk (DAQmxWriteAnalogF64(myTask,1,1,10.0,DAQmx_Val_GroupByChannel,&data,NULL,NULL));
	DAQmxErrChk (DAQmxStopTask(myTask));

 The last line doesn't stop the output and neither does a StopTask then ClearTask call in the "panelCB" EVENT_CLOSE event.

0 Kudos
Message 1 of 6
(4,835 Views)
Solution
Accepted by topic author BLowery

Do an AnalogWrite of 0.0V prior to stopping the task.

 

-AK2DM

 

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 2 of 6
(4,829 Views)

I understand that would work, but is it normal for AO boards (mounted in a PXI chassis) to stay active after closing the program that's controlling them?  That just doesn't make sense to me.  It seems like that fix would be masking a problem.  It also suggests that DAQmxStopTask() and DAQmxClearTask() don't actually do anything except maybe throw away the task handle.

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

@BLowery wrote:

is it normal for AO boards (mounted in a PXI chassis) to stay active after closing the program that's controlling them?


Yes it is.  I'm not saying I agree with that, but every analog output (including Arbitrary Waveform Generators) I have used does this.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 6
(4,804 Views)

Fair enough.  Thanks and fhqwhgads!

Message 5 of 6
(4,798 Views)

 

FWIW, I believe the DSA devices revert to 0 output on their own very shortly after the task is stopped.   They work differently from the "regular" D/A converters found on most of the DAQ boards.   I kinda remember observing this when trying to align a DSA output with a non-delayed "regular" AI output.  It was quick-and-dirty code to figure out the clocking delay needed, but I remember how the regular AI started at seemingly "random" voltages based on whatever phase its sine wave happened to be at when I stopped the last trial run.  However, I think I recall that the DSA always started from 0 volts.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 6 of 6
(4,785 Views)