Counter Output Applications
- Updated2025-08-09
- 10 minute(s) read
Refer to the following sections for more information on the various counter output applications available on the USB-6421.
Simple Pulse Generation
The USB-6421 supports the following methods of simple pulse generation.
Single Pulse Generation
The counter can output a single pulse. The pulse appears on the Counter n Internal Output signal of the counter.
You can specify a delay from when the counter is armed to the beginning of the pulse. The delay is measured in terms of a number of active edges of the Source input.
You can specify a pulse width. The pulse width is also measured in terms of a number of active edges of the Source input. You can also specify the active edge of the Source input (rising or falling).
The following figure shows a generation of a pulse with a pulse delay of four and a pulse width of three (using the rising edge of Source).
Single Pulse Generation with Start Trigger
The counter can output a single pulse in response to one pulse on a hardware Start Trigger signal. The pulse appears on the Counter n Internal Output signal of the counter.
You can route the Start Trigger signal to the Gate input of the counter. You can specify a delay from the Start Trigger to the beginning of the pulse. You can also specify the pulse width. The delay and pulse width are measured in terms of a number of active edges of the Source input.
After the Start Trigger signal pulses once, the counter ignores the Gate input.
The following figure shows a generation of a pulse with a pulse delay of four and a pulse width of three (using the rising edge of Source).
Pulse Train Generation
The USB-6421 supports the following methods of pulse train generation.
Finite Pulse Train Generation
Finite pulse train generation creates a train of pulses with programmable frequency and duty cycle for a predetermined number of pulses
With USB-6421 counters, the primary counter generates the specified pulse train and the embedded counter counts the pulses generated by the primary counter. When the embedded counter reaches the specified tick count, it generates a trigger that stops the primary counter generation. The following figure shows an example of finite pulse train generation.
In Legacy Mode, the counter operation requires two counters and does not use the embedded counter. For example, to generate four pulses on Counter 0, Counter 0 generates the pulse train, which is gated by the paired second counter. The paired counter, Counter 1, generates a pulse of desired width.
The routing is done internally. The following figure shows an example finite pulse train timing diagram.
Retriggerable Pulse or Pulse Train Generation
The counter can output a single pulse or multiple pulses in response to each pulse on a hardware Start Trigger signal. The generated pulses appear on the Counter n Internal Output signal of the counter.
You can route the start trigger signal to the gate input of the counter. You can specify a delay from the start trigger to the beginning of each pulse. You can also specify the pulse width. The delay and pulse width are measured in terms of a number of active edges of the source input. You can apply the initial delay to only the first trigger or to all triggers using the CO.EnableInitalDelayOnRetrigger property. The default for a single pulse is true, while the default for finite pulse trains is false.
The counter ignores the gate input while a pulse generation is in progress. After the pulse generation is finished, the counter waits for another start trigger signal to begin another pulse generation. For retriggered pulse generation, pause triggers are not allowed since the pause trigger also uses the gate input.
The following figure shows a generation of two pulses with a pulse delay of five and a pulse width of three (using the rising edge of Source) with CO.EnableInitalDelayOnRetrigger set to the default true.
The following figure shows the same pulse train with CO.EnableInitalDelayOnRetrigger set to the default false.
The minimum time between the trigger and the first active edge is two ticks of the source.
Continuous Pulse Train Generation
Continuous pulse train generation creates a train of pulses with programmable frequency and duty cycle. The pulses appear on the Counter n Internal Output signal of the counter.
You can specify a delay from when the counter is armed to the beginning of the pulse train. The delay is measured in terms of a number of active edges of the source input.
You specify the high and low pulse widths of the output signal. The pulse widths are also measured in terms of a number of active edges of the source input. You can also specify the active edge of the source input (rising or falling).
The counter can begin the pulse train generation as soon as the counter is armed or in response to a hardware start trigger. You can route the start trigger to the gate input of the counter.
You can also use the gate input of the counter as a pause trigger (if it is not used as a start trigger). The counter pauses pulse generation when the pause trigger is active. The following figure shows a continuous pulse train generation (using the rising edge of source).
Continuous pulse train generation is sometimes called frequency division. If the high and low pulse widths of the output signal are M and N periods, then the frequency of the Counter n Internal Output signal is equal to the frequency of the source input divided by M + N.
Finite Implicit Buffered Pulse Train Generation
Finite implicit buffered pulse train generation creates a predetermined number of pulses with variable idle and active times.
Each point you write generates a single pulse. The number of pairs of idle and active times (pulse specifications) you write determines the number of pulses that are generated. All points are generated back to back to create a user-defined pulse train.
The following table and figure detail a finite implicit generation of three samples.
| Sample | Idle Ticks | Active Ticks |
|---|---|---|
| 1 | 2 | 2 |
| 2 | 3 | 4 |
| 3 | 2 | 2 |
Continuous Buffered Implicit Pulse Train Generation
Continuous buffered implicit pulse train generation creates a continuous train of pulses with variable idle and active times.
Instead of generating a set number of data samples and stopping, a continuous generation continues until you stop the operation. Each point you write generates a single pulse. All points are generated back to back to create a user-defined pulse train.
Finite Buffered Sample Clocked Pulse Train Generation
Finite buffered sample clocked pulse train generation creates a predetermined number of pulse train updates. Each point you write defines pulse specifications that are updated with each sample clock.
When a sample clock occurs, the current pulse (idle followed by active) finishes generation and the next pulse updates with the next sample specifications.
The following table and figure detail a finite sample clocked generation of three samples where the pulse specifications from the create channel are two ticks idle, two ticks active, and three ticks initial delay.
| Sample | Idle Ticks | Active Ticks |
|---|---|---|
| 1 | 3 | 3 |
| 2 | 2 | 2 |
| 3 | 3 | 3 |
The USB-6421 supports three methods of continuous generation for controlling what data is written: regeneration, FIFO regeneration, and non-regeneration.
Continuous Buffered Sample Clocked Pulse Train Generation
Continuous buffered sample clocked pulse train generation creates a continuous train of pulses with variable idle and active times.
Instead of generating a set number of data samples and stopping, a continuous generation continues until you stop the operation. Each point you write specifies pulse specifications that are updated with each sample clock. When a sample clock occurs, the current pulse finishes generation and the next pulse uses the next sample specifications.
Frequency Generation
You can generate a frequency by using a counter in pulse train generation mode or by using the frequency generator circuit.
The frequency generator can output a square wave at many different frequencies. The frequency generator is independent of the four general-purpose 32-bit counter/timer modules on the USB-6421.
The following figure shows a block diagram of the frequency generator.
The frequency generator generates the Frequency Output signal. The Frequency Output signal is the Frequency Output Timebase divided by a number you select from 1 to 16. The Frequency Output Timebase can be either the 20 MHz Timebase, the 20 MHz Timebase divided by 2, or the 100 kHz Timebase.
The duty cycle of Frequency Output is 50% if the divider is either 1 or an even number. For an odd divider, suppose the divider is set to D. In this case, Frequency Output is low for (D + 1)/2 cycles and high for (D - 1)/2 cycles of the Frequency Output Timebase.
The following figure shows the output waveform of the frequency generator when the divider is set to 5.
Frequency Output can be routed out to any DIO <0..15> terminal. All digital I/O terminals are set to high-impedance at startup. The FREQ OUT signal can also be routed to many internal timing signals.
In software, program the frequency generator as you would program one of the counters for pulse train generation.
Frequency Division
The counters can generate a signal with a frequency that is a fraction of an input signal. This function is equivalent to continuous pulse train generation.
Pulse Generation for ETS
In the equivalent time sampling (ETS) application, the counter produces a pulse on the output a specified delay after an active edge on Gate.
After each active edge on Gate, the counter cumulatively increments the delay between the Gate and the pulse on the output by a specified amount. Thus, the delay between the Gate and the pulse produced successively increases.
The increase in the delay value can be between 0 and 255. For instance, if you specify the increment to be 10, the delay between the active Gate edge and the pulse on the output increases by 10 every time a new pulse is generated.
Suppose you program your counter to generate pulses with a delay of 100 and pulse width of 200 each time it receives a trigger. Furthermore, suppose you specify the delay increment to be 10. On the first trigger, your pulse delay is 100, on the second it is 110, on the third it is 120; the process repeats until the counter is disarmed. The counter ignores any Gate edge that is received while the pulse triggered by the previous Gate edge is in progress.
The waveform thus produced at the counter’s output can be used to provide timing for under sampling applications where a digitizing system can sample repetitive waveforms that are higher in frequency than the Nyquist frequency of the system. The following figure shows an example of pulse generation for ETS; the delay from the trigger to the pulse increases after each subsequent Gate active edge.