Solution
When using a DAQmx task in Regeneration Mode, it is not possible to determine which sample is currently being generated or to overwrite particular samples in the circular buffer.
In order to stop regeneration after a particular number of cycles, one of the following options can be used as an alternative:
- Use a counter as the sample clock for the Analog Output task.
- If the number of cycles are known beforehand, configure the Analog Output task for Finite Samples.
Using a Counter Task
- Create a counter that generates a finite pulse of (number of samples in the Analog Output waveform) x (number of cycles required) length.
- Configure the counter as the sample clock for the Analog Output task.
- When the pulse generation is complete, the Analog Output task can be stopped.
Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.
Generating Finite Samples
If the number of cycles are known beforehand, configure an Analog Output task with
(number of samples in the waveform) x (number of cycles required) finite samples.
Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.