From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop this ao task and writer?

When I close the application, the hardware is still output  Voltage 'val' .How to stop this ao task and writer?

Code as follows:

//////////////////////

try
{
CNiDAQmxTask task(_T("AOTask"));

task.AOChannels.CreateVoltageChannel(
physicalChannel,
_T("AOChannel"),
min,
max,
DAQmxAOVoltageUnitsVolts);

CNiDAQmxAnalogSingleChannelWriter writer(task.Stream);
writer.WriteSingleSample(true, val);
}
catch(CNiDAQmxException *e)
{
e->ReportError();
e->Delete();
}

0 Kudos
Message 1 of 1
(3,783 Views)