03-31-2015 02:46 PM - edited 03-31-2015 02:51 PM
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.
Solved! Go to Solution.
03-31-2015 03:03 PM
Do an AnalogWrite of 0.0V prior to stopping the task.
-AK2DM
04-01-2015 07:04 AM
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.
04-01-2015 07:10 AM
@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.
04-01-2015 08:56 AM
Fair enough. Thanks and fhqwhgads!
04-01-2015 10:04 AM
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