3-34 | ni.com
Chapter 3 Counters
Generating a Waveform with Variable Frequency and
Duty Cycle
Figure 3-40 shows an example of a waveform with variable frequency and duty cycle.
Figure 3-40. Waveform with Variable Frequency and Duty Cycle
The counter begins by generating a waveform with an initial frequency and duty cycle. On the
first active edge of sample clock, the NI 6612 reads the first sample out of the buffer. The first
sample consists of two values: frequency1 and duty_cycle1. The counter begins generating a
waveform with frequency1 and duty_cycle1.
On the second active edge of the sample clock, the NI 6612 changes the waveform to have
frequency2 and duty_cycle2. On the third edge of the sample clock, the NI 6612 changes the
waveform to have frequency3 and duty_cycle3, and so on.
When the NI 6612 detects an active edge of the sample clock, it finishes generating the current
pulse (idle and active level) before beginning the new waveform frequency/duty cycle.
You can specify the waveform buffer in terms of:
• Frequency and duty cycle
• Idle time and active time of each pulse
• Idle ticks and active ticks of each pulse
A tick is one period of the counter timebase (by default, 10 ns).
Create Channel
Use one of the following functions to create a channel. Select the VI or function that corresponds
to the format of the data in the waveform buffer:
• DAQmx Create Channel (CO Pulse-Generation Frequency)—The frequency and duty
cycle inputs to the function determine the initial frequency and duty cycle of the waveform.
That is, the frequency and duty cycle of the waveform before the first sample clock.
• DAQmx Create Channel (CO Pulse-Generation Time)—The high time and low time
inputs determine the initial waveform.
• DAQmx Create Channel (CO Pulse-Generation Ticks)—The high ticks and low ticks
inputs determine the initial waveform.
Output
Sample Clock
Initial Frequency,
Duty Cycle
Sample 1
(Frequency 1,
Duty Cycle 1)
Sample 2
(Frequency 2,
Duty Cycle 2)