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.
Figure 2 Place the
DAQ AssistantExpress VI, located on theFunctions>>Inputpalette, in aWhile Loop. Complete the following steps to configure the counter to perform event counting.- Select
Counter Input>>Edge Countfor the measurement to make. - Select
Dev1>>ctr0for the physical channel. - In the
Counter Input Edge Count Task Configurationdialog 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 toPFI8. - Click the
OKbutton to close theCounter Input Edge Count Task Configurationdialog box. This saves all the settings specified for the task in theDAQ Assistant Express VI.
- Select
- Save the VI as
Simple Event Counting.viin theC:\Exercises\LabVIEW Basics Idirectory. - 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 Eventsindicator 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 AssistantExpress VI, and change theCount Directionpull-down menu toExternally Controlled. Click theOKbutton 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 Eventsindicator 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