Digital Output Data Generation Methods
- Updated2024-12-11
- 2 minute(s) read
When performing a digital output operation, you either can perform software-timed or hardware-timed generations. Hardware-timed generations must be buffered.
Software-Timed Generations
With a software-timed generation, software controls the rate at which data is generated. Software sends a separate command to the hardware to initiate each digital generation. In NI-DAQmx, software-timed generations are referred to as on-demand timing. Software-timed generations are also referred to as immediate or static operations. They are typically used for writing out a single value.
For software-timed generations, if any DO channel on a serial digital module is used in a hardware-timed task, no channels on that module can be used in a software-timed task.
Hardware-Timed Generations
With a hardware-timed generation, a digital hardware signal controls the rate of the generation. This signal can be generated internally on the chassis or provided externally.
Hardware-timed generations have several advantages over software-timed acquisitions:
- The time between samples can be much shorter.
- The timing between samples is deterministic.
- Hardware-timed acquisitions can use hardware triggering.
Hardware-timed DO operations on the cDAQ chassis must be buffered.
Buffered Digital Output
A buffer is a temporary storage in computer memory for generated samples. In a buffered generation, data is moved from a host buffer to the cDAQ chassis onboard FIFO before it is written to the C Series module(s).
One property of buffered I/O operations is sample mode. The sample mode can be either finite or continuous:
- Finite—Finite sample mode generation refers to the generation of a specific, predetermined number of data samples. After the specified number of samples is written out, the generation stops.
- Continuous—Continuous generation refers to the generation of an unspecified number of samples.
Instead of generating a set number of data samples and stopping, a continuous
generation continues until you stop the operation. There are three different
continuous generation modes that control how the data is written. These modes are
regeneration, onboard regeneration, and non-regeneration:
- In regeneration mode, you define a buffer in host memory. The data from the buffer is continually downloaded to the FIFO to be written out. New data can be written to the host buffer at any time without disrupting the output.
- With onboard regeneration, the entire buffer is downloaded to the FIFO and regenerated from there. After the data is downloaded, new data cannot be written to the FIFO. To use onboard regeneration, the entire buffer must fit within the FIFO size. The advantage of using onboard regeneration is that it does not require communication with the main host memory once the operation is started, which prevents problems that may occur due to excessive bus traffic or operating system latency.
- With non-regeneration, old data is not repeated. New data must continually be written to the buffer. If the program does not write new data to the buffer at a fast enough rate to keep up with the generation, the buffer underflows and causes an error.