The M Series of National Instruments MIO data acquisition products includes 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 I/O subsystem 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 program illustrates how to perform a finite, buffered, digital input task correlated to a concurrent analog input task.
1. Create virtual channels for the analog and digital input channels
2. Configure the master sample clock (in this case, analog input)
3. Select the timing source for the digital acquisition
(M Series digital can be correlated to the analog, counter/timer, and external clocks)
4. Begin the digital task, preparing it to start with the master
5. Begin the analog task (the master in this case)
6. Read data from the analog and digital tasks and graph the results
7. Clear the tasks to free memory and display any errors
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.