NI-DAQmx: Generate a Finite Digital Pulse Train in .NET
Overview
This example demonstrates how to generate a finite digital pulse train from a counter output channel. The Frequency, Duty Cycle, and Idle State are all configurable.
Description:
This example demonstrates how to generate a finite digital pulse train from a counter output channel. The Frequency, Duty Cycle, and Idle State are all configurable.
This example shows how to configure the pulse in terms of Frequency/Duty Cycle, but can easily be modified to generate a pulse in terms of Time or Ticks.
Instructions for running:
- Enter the physical channel which corresponds to the counter you want to use to output your signal to on the DAQ device.
- Enter the Frequency and Duty Cycle to define the pulse parameters. Enter the Number Of Pulses into the DAQmx Timing VI to determine the duration of the generation
Note: Use the Measure Period example to verify you are outputting the finite pulse train on the DAQ device.
Steps
- Create a counter output channel to produce a pulse in terms of frequency. If the idle state of the pulse is set to low, the first transition of the generated signal is from low to high.
- Use the Task.Timing.ConfigureImplicit method to configure the duration of pulse generation and the number of pulses to generate.
- Call Task.Start to arm the counter and begin the pulse generation.
- Use Task.WaitUntilDone to ensure the entire pulse is generated before ending the task.
- Call Task.Dispose to free the task and de-allocate the hardware resources it uses.
I/O Connections Overview
This example will cause the counter to output the pulse on the output
terminal of the counter specified. The default counter terminal(s) depend on
the type of measurement being taken. For more information on the default
counter input and output terminals for your device, open the NI-DAQmx Help,
and refer to Counter Signal Connections found under the Device
Considerations book in the table of contents.
Requirements
Filename: gendigpulsetrain_finite.zip
Software Requirements
Language(s): Visual Basic .NET, C#
Hardware Requirements
Driver: NI-DAQmx 8.6
Reader Comments | Submit a comment »
Legal
This example program (this "program") was developed by a National Instruments ("NI") Applications Engineer. Although technical support of this program may be made available by National Instruments, this program may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this program with each new revision of related products and drivers. THIS EXAMPLE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).
