Hello friends,
Let's consider a hypothetical situation where I have an application and in it I configure my analog output in finite sample quantity mode such that it is going to output 10000 samples out of analog output channel 0. The configuration could look something like the following...
private Task _task;
private AnalogSingleChannelWriter _writer;
private double[] _sampleArrayToOutput = new[] { /*10000 arbitrary values go here*/ };
_task = new Task("AnalogOutputTask");
_task.AOChannels.CreateVoltageChannel("Dev4/ao0", "ao0", -10, 10, AOVoltageUnits.Volts);
_task.Timing.ConfigureSampleClock("", SamplingInfo.SampleRate, SampleClockActiveEdge.Rising,
SampleQuantityMode.FiniteSamples, 10000);
_task.Control(TaskAction.Verify);
_writer = new AnalogMultiChannelWriter(_task.Stream);
Then the code to start the analog output could look something like the following...
_writer.WriteWaveform(false, _sampleArrayToOutput);
_task.Start();
Let's assume that it takes 2 seconds to complete the output of all 10000 samples. And let's say that 1 second after calling _task.Start() I want the hardware to immediately stop outputting samples out of analog output 0, even though it has not finished outputting all 10000 samples.
How can I achieve this?