NI-DAQmx: Generate Digital Pulse with Start Trigger in .NET
Overview
This example shows how to generate a digital signal with a start trigger using C# or VB.NET with Measurement Studio for Visual Studio 2005.
Table of Contents
Downloads
Filename: gendigpulse_digtrig_vb.zip
Requirements: View
Filename: gendigpulse_digtrig_cs.zip
Requirements: View
Description
This example demonstrates how to generate a single digital pulse from a
counter output channel using a digital start trigger. The initial delay,
high time, low time, and the idle state are all software configurable.
The trigger source and trigger edge are also software configurable.
This example shows how to configure the pulse in terms of time, but can easily
be modified to generate a pulse in terms of frequency and duty cycle or ticks.
Instructions for running
1. Enter the physical channel which corresponds to the counter you want to
use to output your signal to on the DAQ device.
2. Enter the low time and high time (in seconds) to define the pulse
parameters. Additionally, you can set the initial delay (in seconds)
which will delay the beginning of the pulse from the start call. Also,
you can change the idle state to generate a high or low pulse.
3. Setup the trigger parameters. The default in this example is a rising
edge digital trigger on PFI9 (the default gate of ctr0).
Note: Use the MeasPulseWidth example to verify you are outputting a pulse
on the DAQ device.
Steps
1. Create a counter output channel using
Task.COChannels.CreatePulseChannelTime to produce a pulse in terms of
time. If the idle state of the pulse is set to low the first transition
of the generated signal is from low to high.
2. Configure the Triggers object to have pulse generation start on a
digital edge.
3. Call Task.Start to arm the counter and begin wait for trigger to start the
pulse generation. After the start trigger, the pulse will not begin until
after the initial delay (in seconds) has expired.
4. Use Task.IsDone to ensure the entire pulse is generated before
ending the task.
5. Call Task.Stop and 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: gendigpulse_digtrig_vb.zip
Software Requirements
Application Software: Measurement Studio .NET Support 8.5
Language(s): Visual Basic .NET
Hardware Requirements
Hardware Group: Counter/Timers (TIO)
Driver: NI-DAQmx 8.6
Software Requirements
Application Software: Measurement Studio .NET Support 8.5
Language(s): C#
Hardware Requirements
Hardware Group: Counter/Timers (TIO)
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/).
