Generating Pulses

NI-DAQmx

Generating Pulses

Some measurement devices can generate a pulse from the counter of the device. A pulse is a signal whose amplitude deviates from zero for a short period of time. The pulse is either high or low. A high pulse starts low, pulses high, and returns low, and a low pulse starts high, pulses low, and returns high.

Note  You can use Butterworth filters only in the LabVIEW Full and Professional Development Systems.

A pulse train is more than one pulse. You can use a pulse or pulse train as a clock signal, a gate, or a trigger for a measurement or a pulse generation. You can use a single pulse of known duration to determine an unknown signal frequency or to trigger an analog acquisition. You can use a pulse train of known frequency to determine an unknown pulse width.

Each pulse or pulse train consists of three parts:

  • Initial Delay—The amount of time the output remains at the idle state before generating the pulse.
  • High Time—The amount of time the pulse is at a high level.
  • Low Time—The amount of time the pulse is at a low level.

The period of the pulse is the sum of the high time and the low time. The frequency is the reciprocal of the period, 1/period.

The following figure shows the parts of a pulse.

The following figure shows the parts of a pulse train.

Before you generate a pulse, you need to determine if you want to output the pulse or pulse train in terms of frequency, time, or number of ticks of the counter timebase. For frequency, you need to determine the duty cycle. For time, you specify the high time and the low time. Use the number of ticks if you are using a counter timebase with an unknown rate. When you configure a pulse generation, the output appears at the counter output terminal.

The idle state controls the pulse generation polarity. When you set the idle state to low, the pulse generation starts low for the initial delay, transitions to high for the high time, and transitions to low for the low time, as shown in the following figure. The high time and low time repeat for each pulse.

When you set the idle state to high, the pulse generation starts high for the initial delay, transitions to low for the low time, and transitions to high for the high time, as shown in the following figure. In both cases, the output rests at the idle state after the pulse generation completes.

When generating pulses, you can generate either a single pulse, a finite pulse train, or a continuous pulse train. You can update the high time and low time of a continuous pulse train generation at any time, including while the application is running. This is useful for applications that require pulse width modulation, such as proportional integral derivative (PID) loop control applications.

By default, single pulses are generated unless you use the Timing function/VI with the implicit timing type. The Samples Per Channel input to the Timing function/VI determines the number of pulses to generate for finite pulse trains. Generating a single pulse or a continuous pulse train only requires the use of one counter. However, generating finite pulse trains requires the use of paired counters.

You can configure a variety of triggers with pulse generations. All pulse generations support Start Triggers. Single pulse generation and finite pulse train generation also support the Retriggerable property, or attribute, for Start Triggers. To determine if a pulse is complete and the hardware is ready for another Start Trigger, query the Pulse Done property. Continuous pulse train generations also support pause triggers. However, you cannot use both the start and the pause trigger at the same time.

You can use the same properties that create the channel to update the rate of the pulse train generation. Because you need two properties to specify the rate of the pulse train, the rate only updates when you set one of the two properties. For example, if you specify the pulse generation in terms of frequency, the frequency and duty cycle properties control the rate of the generation. However, the rate only updates when you set the frequency property. The same is true when you specify pulse generation in terms of time or ticks; the low time and low ticks properties control when the rate updates. When updating the rate of the pulse generation, a complete period of the current rate generates before the new rate takes effect.

Making Signal Connections

Creating a Program

Generating a Pulse

Generating a Finite Pulse Train

Generating a Continuous Pulse Train

Examples