Document Sample
lab2 Powered By Docstoc
					                     GVSU Padnos School of Engineering
                              EGR 345-03

                              Laboratory Exercise #2

                    Title: Computer Based Data Collection

                              Author: Joel Geerlings

                            Date: September 13, 2001

      Use computers with LabVIEW to collect data.

      To obtain the greatest power and flexibility, engineers must often write their own
      computer programs. Traditional programming languages are often awkward to
      use when designing user interfaces and dealing with data flows. LabVIEW
      avoids this by allowing the user to design systems graphically by connecting
      graphical symbols with “wires” (lines).

       Computers read data at discrete points in time, much like a strobe light, and then
       use the data for calculations. LabVIEW is useful for data collection. Programs
       can be written by drawing function blocks and connecting them in the order the
       data must flow. This lab exercise involves using LabVIEW to connect to a data
       acquisition (DAQ) board. The DAQ allows data from the outside world to be
       collected, and changes the outside world through outputs.

       When a computer connects to the outside world using an interface card, specific
       inputs and outputs must be addressed. The first portion of the address is the board
       number of the DAQ, which is „1‟ in this case. The DAQ contains many inputs
       and outputs. For analog outputs, the DAQ contains two channels, 0 or 1. For
       analog inputs, there are 8 channels, numbered 0 to 7. For digital I/O, there are 24
       pins, spread across 3 ports; therefore, when collecting inputs and outputs, we must
       specify which port (PA=0, PB=1, PC=2) and which channel from 0 to 7. Digital
       I/O ports can be used for input or output, but each port can only serve one

       The voltage levels of inputs and outputs are also important. Digital outputs are
       only 0V or 5V. Analog inputs and outputs vary from –5V to 5V. If these values
       are exceeded significantly, the board can be permanently damaged.

     PC with LabVIEW software and PCI-1200 DAQ Card
     Interface cable
       CADET Trainer Board
       Digital Multimeter

Procedure and Discussion:
      The LabVIEW Quickstart guide was reviewed and the prelab exercise was
      performed. The prelab exercise involved writing a LabVIEW program capable of
      counting from 1 to 100, squaring the values, and printing the results in a strip
      chart. This was performed by setting up a FOR Loop designed to repeat 100
      times. Each time the loop was executed, „i‟ was incremented by 1, the value was
      squared, and it was printed in the strip chart. The prelab exercise proved to be
      difficult because it was an unfamiliar program, and understanding how to properly
      set up a loop took a few attempts.

       The first exercise in the lab involved writing a LabVIEW program capable of
       inputting a signal from a signal generator and graphing it. The function generator
       on the CADET trainer was used to produce a 5V waveform with a frequency of
       about 1 Hz. The function generator was connected to ACH0 (analog input 0),
       which was pin 1 on the interface cable. The ground on the trainer was connected
       to AIGND (analog ground), which was pin 0 on the cable. The „DAG Configure‟
       software was then used to verify the hardware was properly setup. Once the
       hardware was working properly, the LabVIEW program was written/designed.
       The LabVIEW program involved inputting the signal and the ground with a single
       analog input, and sending the signal to a waveform chart. The program operated
       correctly and enabled the computer to collect data from the outside world (the
       function generator) and display it in a chart.

       The second exercise involved setting up a voltage output that could be controlled
       by the user. A voltage input knob and an output meter were used in the
       LabVIEW program to supply a voltage and monitor it. This function was tested
       and the input knob worked with the output meter showing the voltage. Then the
       program was expanded to output the voltage to a digital multimeter on
       DAC0OUT (digital to analog converter output 0) or pin 10. A DMM, grounded
       on AGND (analog ground), or pin 11, measured the voltage output. This was
       measured to verify the knob and meter. The DMM showed that the program
       worked correctly, and that the computer could be used to output a user-controlled

       The third exercise involved inputting a signal from a manual switch to control a
       computer simulated LED, while simultaneously outputting a signal from a
       computer simulated switch to control a LED on the circuit trainer. First the
       circuit trainer was wired to the interface cable. PB0 (digital I/O B-0) or pin 22 on
       the cable was connected to an LED on the trainer. PA0 (digital I/O A-0) or pin 14
       was connected to a logic switch on the trainer. DGND (digital ground) or pin13
       was connected to the ground on the trainer. The „DAQ Configure‟ utility was
       used to verify the hardware setup, which indicated that PA0 was not inputting
       correctly, so PA2 was used instead. With the input working properly, the output
       port PB appeared to be malfunctioning, so PC0 was used instead for the output.
       Once the hardware problems were taken care of, a program in LabVIEW could be
       written to interface with the hardware. To allow a „switch‟ in LabVIEW to
       control the LED on the trainer, a “Write to Digital Line” function was used. This
       was setup to read the switch on LabVIEW and send a voltage out PA2 if the
       switch was on. Next, the LED in LabVIEW had to be programmed to light up
       when a voltage was inputted in PC0. A “Read from Digital Line” function was
       setup to signal the simulated LED to light up when a voltage came in PC0. This
       program worked correctly and showed that a computer can simultaneously control
       an outside system, while being controlled by a second outside system.

Results and Conclusions:
       In conclusion, the lab exercises all performed correctly. However, some of the
       exercises took significant effort getting the hardware and LabVIEW program to
       work together properly. The final versions demonstrated the computer‟s
       capability to collect data and simultaneously control outside systems.

Shared By: