LabVIEW Example—Hardware-Timed Simultaneously Updated I/O
Note Although this example is written for LabVIEW users, the principles apply if you are using another ADE, such as LabWindows/CVI. |
LabVIEW Example
- Wire the Wait For Next Sample Clock VI to one of the hardware-timed tasks. Use dataflow wiring to guarantee that the Wait For Next Sample Clock VI executes after the AO Write call.
- If the Wait For Next Sample Clock VI does not start before the arrival of the next sample clock edge, it returns an error.
Sample Block Diagram
Notes
- Use only one Wait For Next Sample Clock VI within a LabVIEW loop. If you have multiple hardware-timed single-point I/O tasks within the same LabVIEW loop, you can connect the Wait For Next Sample Clock VI to any one hardware-timed single point task within that loop.
- If, when a cycle overflow occurs, you want to receive a warning rather than an error, set the DAQmx Real-Time»Convert Late Errors to Warnings property to True.
- Wait For Next Sample Clock has two modes of operation: Polling and Wait For Interrupt. Wait For Interrupt mode, which is the default, allows lower priority processes to execute while the time-critical loop waits for the next sample clock. Polling mode allows for higher sampling rates, but it prevents lower priority processes in the system from executing while the time-critical loop waits for the next sample clock.
- Analog DAQmx Read calls have two modes of operation: Polling and Wait For Interrupt. Wait For Interrupt mode allows lower priority processes to execute while the time-critical loop waits for all the requested samples to be converted. Polling mode allows for higher sampling rates, but it prevents lower priority processes in the system from executing while the time-critical loop waits for the converted analog samples.
- The specific application shown in this section assumes the use of Wait For Interrupt mode for both the Wait For Next Sample Clock VI and the DAQmx Analog Read VI. Too change these values, use the DAQmx Read»Advanced»Wait Mode and/or DAQmx Real-Time»Wait For Next Sample Clock Wait Mode properties.