This VI allows you to trigger a pulse to be outputted after a set number of pulses from an incoming signal are counted.
This VI uses the DAQmx drivers to accomplish this functionality. The main VI used is the CO Pulse Ticks VI, which can be configured in several ways to define the behavior of when and how to output a pulse. When using this VI, you select a digital signal as the input. This is the signal that the CO Pulse Ticks will count edges from to determine when to output a pulse. It can be the output of a counter, an encoder, or any other type of digital signal. To define the behavior of the output pulse, the CO Pulse Ticks VI has inputs for "low ticks" and "high ticks". The "low ticks" input defines how many counts of the input signal that the output needs to remain low. Conversely, the "high ticks" input defines how many counts of the input signal the output needs to be high. The low output count is performed before the high output count. For example, if low ticks was set to 15 and high ticks was set to 5, the output would be low for the first 15 pulses (or edges) of the incoming signal, and then be high for the next 5. This is VI is hardware retriggerable, so the behavior will immediately repeat after one cycle is completed and another trigger is received.
This VI is great for custom triggering such as needing a trigger that occurs exactly after 5 minutes have passed, or after an angular encoder has turned exactly 17 degrees, etc.
This VI can also be made to run continuously by changing the Timing VI from "finite samples" to "continuous" samples. In this fasion, the above example would result in 15 low, 5 high, 15 low, 5 high, 15 low, 5 high, etc. (a 25% duty cycle output) until the task is stopped. This could easilty be 30,000 low ticks and 2 high ticks, or any other combination of values.
LabVIEW 2010 or compatible
DAQmx 9.1.5 or compatible
DAQ device that has available counters
Steps to Implement or Execute Code
Download and extract the appropriate version for your LabVIEW installation below.
Set the number of high and low ticks to get the behavior that you want.
Run and notice the behavior.
Additional Information or References
**This document has been updated to meet the current required format for the NI Code Exchange.**
Ryan P. National Instruments | Systems Engineer | CLA