NI-DAQmx: Correlated Digital I/O with NI CompactDAQ and LabVIEW
Overview
Correlated Digital IO enables the coupling of buffered digital tasks with the analog, counter/timer, or external clocks. The CompactDAQ 9172 chassi includes the capability of synchronizing digital input and output. The cDAQ-9172 chassi includes two on-board counters that can be used as external signals to correlate digital input and output. This example program illustrates how to perform correlated DIO with a counter output task using the internal clock on the cDAQ-9172.
Downloads
Filename: correlated_dio_cdaq.vi
Requirements: View
1. Create a Digital Input Channel,a Digital Output Channel, and a Counter Output channel to produce a Pulse in terms of Frequency.
2. Call the DAQmx (Sample Clock) VI which sets the sample clock rate for the digital tasks. Additionally, set the sample mode to continuous.
2a. Call the Get Terminal Name with Device Prefix VI. This will take a Task and a terminal and create a properly formatted device + terminal name to use as the source of the digital sample clock. The terminal used is Counter N's Internal Output. The Match Pattern VI is used to determine which counter was specified.
2b. Create digital waveform to be outputted to the buffer.
3. Write the waveform to the output buffer.
4. Call the Start VI on the digital tasks.
5. Call the Start VI on the counter task. Use the sequence structure to ensure that both digital tasks are started before the counter task.
6. Read the digital waveform. Additionally, Call Is Task Done to check for errors in the digital output and counter tasks.
7. Call the Clear Task VI to clear each Task.
8. Use the popup dialog box to display an error or warning if any.
Note1: Make sure to select the internal counters on the cDAQ-9172 by selecting the appropriate I/O filtering name.
By Default, the DAQmx physical channel control drop down menu will not list internal channels. To configure the DAQmx physical channel control drop down menu to include internal channels:
Right-click the DAQmx physical channel control in the front panel.
1. Select I/O Name Filtering
2. When the Filter Names dialog appears, check the Internal Channels check box.
3. Click OK and select one of the two counters of the form: cDAQ1/_ctr0
Note2: Make sure to also verify that your DIO module is in slots 1 through 4 for buffered hardware tasks.
Requirements
Filename: correlated_dio_cdaq.vi
Software Requirements
Application Software: LabVIEW Base Development System 8.0
Language(s): LabVIEW
Hardware Requirements
Hardware Group: CompactDAQ
Hardware Model: NI 9229, NI 9233, NI 9237, NI 9239, NI 9421, NI 9264, NI 9265, NI 9375, NI 9401, NI 9411, NI 9263
Driver: NI-DAQmx 8.3
Reader Comments | Submit a comment »
Look here:
http://digital.ni.com/public.nsf/allkb/9D58
153D1B5E5B66862574C8006A30FB
- Aug 9, 2009
Where do I find these vis
Where do I find 'Get Terminal Name with
Device Prefix.vi' and Create Digial
Vaveform.vi'
- Thatcher Howard, Northrop Grumman. aquaman55_2000@yahoo.com - Aug 7, 2009
They are utility VIs that ship with the
examples. See this KB 4PHDCD9G: Where Can I
Find Get Terminal Name with Device Prefix VI?
- Jul 6, 2009
Useful, now i just need to know if the
Counter output can be triggered
externally.
The front panel will not open in 8.6.1f1.
Workaround:
Drop the vi on a block diagram.
Open the VIs block diagram (Hold
control down and dbl. click on it).
Copy the all the content of the block
diagram to a new VI.
Now it works.
- Simon Viftrup, CIM Industrial Systems A/S. ssv@cim.as - Jun 18, 2009
This VI crashes Labview 8.6.1 when
opened.
- Mar 12, 2009
Could someone tell me where i can find
these VI: "Get Terminal Name with
Device Prefix.vi" and "Create Digital
Waveform.vi"
- hanga@savio.it - Jun 23, 2008
correlated_dio_cdaq.vi missing parts
Hi,
This example looks useful, but it is
missing the files "Get Terminal Name
with Device Prefix.vi" and "Create Digital
Waveform.vi" Please let me know where
I can find them. Thanks.
- Feb 14, 2008
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/).
