Application Case 4—Hardware-Timed Counter Tasks

Requirement

"I want to use hardware-timed counter input operations to drive my control loop."

Solution

Use the Wait For Next Sample Clock VI to synchronize the counter operations with the counter's sample clock.

Advantages

Restrictions

Read, process, and write operations are confined to the time available between the moment the device starts acquiring data and the moment the next sample clock edge arrives.

Sample Application

An example of this kind of application is a control loop that uses a counter input task, such as count edges, while controlling digital lines based on some predefined control logic. This sample application performs communication through the use of real-time FIFOs.

Sample Timing Diagram

Sample Implementation

Sample Block Diagram

Sample Application 2

Another example application is a control loop that monitors discrete inputs and uses the values to update a counter output task, using pulse frequency mode to generate pulse-width modulation control signals. This example application performs communication through the use of real-time FIFOs.

Sample Timing Diagram

Sample Implementation

Sample Block Diagram

Notes