Summary: In this exercise, the objective is to create a simple event counting VI. Complete the following steps to build a VI that counts pulses from the quadrature encoder on the DAQ Signal Accessory.
EXERCISE 1
1.A) Front Panel
- Open a blank VI and build the front panel shown in Figure 1.
Figure 1
1.B) Block Diagram
- Build the block diagram shown in Figure 2.Place the
Figure 2 DAQ Assistant
Express VI, located on theFunctions>>Input
palette, in aWhile Loop
. Complete the following steps to configure the counter to perform event counting.- Select
Counter Input>>Edge Count
for the measurement to make. - Select
Dev1>>ctr0
for the physical channel. - In the
Counter Input Edge Count Task Configuration
dialog box that appears, leave the settings as they are. The default settings define the source of the counter as beingProgrammable Function Input
(PFI
) 8, which is the default source for counter 0. The DAQ Signal Accessory connects counter 0 source input toPFI
8. - Click the
OK
button to close theCounter Input Edge Count Task Configuration
dialog box. This saves all the settings specified for the task in theDAQ Assistant Express VI
.
- Select
- Save the VI as
Simple Event Counting.vi
in theC:\Exercises\LabVIEW Basics I
directory. - On the DAQ Signal Accessory, wire the A output of the quadrature encoder to the SOURCE input of counter 0.
- Run the VI. Rotate the quadrature encoder knob on the DAQ Signal Accessory. Notice that the
Number of Events
indicator increments as you rotate the knob. The quadrature encoder knob produces pulses as you rotate the knob. The counter counts these pulses. - Stop the VI.
- Double-click the
DAQ Assistant
Express VI, and change theCount Direction
pull-down menu toExternally Controlled
. Click theOK
button to close the configuration dialog box. The DAQ Signal Accessory internally connects phase B of the quadrature encoder to the Up/Down line for counter 0. This can be used to determine the direction the knob has turned. - Run the VI. Rotate the quadrature encoder knob on the DAQ Signal Accessory. Notice that the
Number of Events
indicator decrements when you rotate the knob clockwise, and increments when you rotate the knob counterclockwise. - Save and close the VI.
No comments:
Post a Comment