The M Series data acquisition products include the capability to synchronize digital input and output with other operations. "Correlated Digital IO" enables the coupling of buffered digital tasks with the analog, counter/timer, or external clocks. The Digital subsystem of an M Series device does not have its own internal clock source, and therefore, an external signal or clock from another subsystem on the board must be provided - thus correlating the digital data to this signal.
This example demonstrates how to continuously output analog data while synchronously outputting correlated digital data on an M Series DAQ device. The synchronized outputs use the same onboard sample clock, ao/SampleClock. After the outputs have been configured and started, data is continuously written until an error occurs or the stop button on the front panel of this VI is pressed.
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.