Using Counters and Digital I/ODigital input and output are the foundation of computer technology. They are able to communicate a True or False or 1’s and 0’s. Digital outputs are often used to indicate if a threshold has been passed or to apply power to a circuit. Digital inputs are often used to trigger the acquisition of signals. Counters provide the functionality of outputting a square wave pulse train as well as count digital edges. This module introduces digital and counter I/O concepts using NI LabVIEW software. Step-by-Step ProcedureDownload the Step-by-Step Procedure PDF The following procedure outlines how to count the number of digital pulses received on the counter pin of an NI Educational Laboratory Virtual Instrumentation Suite (NI ELVIS) II device, and then how to output the digital value to the digital port of the device in binary format. This procedure requires a single-pole double-throw (SPDT) switch as well as eight 330 Ω resistors and eight LEDs. Note: If you have a jumper wire connected to your counter input pins that is toggled between DGND, the +5 V rail achieves the same results as an SPDT switch.
Note: LEDs are diodes, so they allow current to flow in only one direction. If an LED does not light up when the 5 V voltage is applied, reverse the direction/polarity of the LED because this is most likely happening because the LED is reversed. If it still does not light up, the LED may no longer be working.
You can convert your DAQ Assistant Express VIs into low-level NI-DAQmx functions by right-clicking the DAQ Assistant and selecting Generate NI-DAQmx Code. The low-level NI-DAQmx API exposes more functionality and customization options for programming. LabVIEW Example Code Right-click on the above VI snippet and select Save Image As... Locate the file on your hard disk and click and drag the file icon onto your LabVIEW block diagram. LabVIEW automatically generates the code from the VI snippet. For more information, read VI Snippets. For a low-level NI-DAQmx driver example for this concept, open the NI Example Finder and browse to Hardware Input and Output»DAQmx»Counter Measurements»Count Digital Events»Count Digital Events.vi to count edges, and Hardware Input and Output»DAQmx»Digital Generation»Cont Write Dig Port-Int Clk.vi to generate digital signals in the NI Example Finder. View detailed help on using the NI Example Finder and help within LabVIEW. Don’t have NI-DAQmx installed on your PC? Module Exercise: Using Counters and Digital I/ODownload the Module Exercise PDF Exercise A: Using Counters and Digital I/O Exercise Goal Required Hardware Things to Consider
Here is an example of what the final signal should look like on a graph indicator: View the exercise solution (Don’t cheat!). Exercise B: Using Counters and Digital I/OExercise Goal Required Hardware Things to Consider
View the exercise solution (Don’t cheat!). Cumulative Exam:
|


