NI-DAQmx: Generate Finite Digital Pulse Train with Digital Start in .NET
Overview
This example demonstrates how to generate a finite digital pulse train from a Counter Output Channel. The Frequency, Duty Cycle, Initial Delay, and Idle State are all configurable. This example uses two counters. 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.
Description
This example demonstrates how to generate a finite digital pulse train from a Counter Output Channel. The Frequency, Duty Cycle, Initial Delay, and Idle State are all configurable. This example uses two counters. 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
Select the Physical Channel which corresponds to the counter you want 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: if the Number of Pulses is greater than 1, the paired counter will also be used for the generation). Additionally, you can set the Initial Delay (in seconds) which will delay the beginning of the pulse train from the start call. Also, you can change the Idle State to set the state the line will remain in after the generation is stopped.
Note: Use the Measure Period example to verify you are outputting the finite pulse train on the DAQ device.
Steps:
- Create a Task object. Create a COChannel object for pulse generation 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.
- Configure the Triggers object to have pulse generation start on a digital edge.
- Use the ConfigureImplicit() method to configure the pulse generation to be finite.
- Call the Start() method to arm the counter and begin waiting for the trigger to start the pulse train generation.
- Call the Stop() method to stop the task and Dispose() method to de-allocate any resources used by the Task.
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: digpulsetrainfinitedigstart.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/).
