30. Lab 10: IO Using Labview


To use Labview for analog digital and analog IO.


Programming languages are essential components of complex systems. Languages such as ’C’ execute one function at a time as the program executes. This is good for program with a clear execution order. However for programs dealing with a continuous system this can be cumbersome.

Labview is a dataflow methodology, like a block diagram. This allows the creation of programs that show how inputs flow through functions to create outputs. Labview allows us to write programs for calculation and data collection, but instead of typing instructions we draw function blocks and connect them. How we connect them determines how the data (numbers) flow. The functions are things like data reads and calculations.

In general people can learn to write simple Labview programs quickly, however more complicated programming tasks can be more difficult than similar programs written in C. But, Labview has a distinct advantage when developing Graphical User Interfaces.


The computers we will use all have DAQ (Data AcQuisition) boards: National Instruments PCI-1200 DAQ cards. These cards have capabilities that include:

24 I/O bits: TTL 0,5VDC, 20mA max.

8 single ended or 4 double ended analog inputs: 12 bits

3 counters: 16 bits

2 analog outputs: 12 bits

The connector for the card, shown in Figure 30.1 PCI-1200 Card edge connector pinout, can be found on the back of the computer. It will have a connector with pinouts like the one shown below. A ribbon cable will be used to make electrical connection to the connector in the back of the computer.


Figure 30.1 PCI-1200 Card edge connector pinout


In this lab we will be using Labview to connect to a data acquisition (DAQ) board in the computer. This will allow us to collect data from the world outside the computer, and make changes to the world outside with outputs.

When interfacing to the card using a program such as Labview, there must be ways to address or request information for a specific input or output (recall memory addresses in EGR226). The first important piece of information is the board number. There can be multiple DAQ boards installed in the computer. In our case there is only one, and it is designated device ’1’. There are also many inputs and outputs available on the card. For analog outputs there are two channels so we need to specify which one when using the output with 0 or 1. For analog inputs there are 8 channels, and as before, we must specify which one we plan to read from using 0 to 7. For digital I/O there are a total of 24 pin distributed across 3 ports (1 byte each). Therefore when connecting inputs and output we must specify the port (PA=0, PB=1, PC=2) and the channel from 0 to 7. Note is that we can make the ports inputs or outputs, but not mixed: in other words we must pick whether a port will only be used for inputs or for outputs.

The voltage levels for the inputs and outputs are important, and you will need to be aware of these. For the digital outputs they will only ever be 0V or 5V. But the analog inputs and outputs will vary from -5V to 5V. This is build into the board. If we exceed these voltage limits by a few volts on the inputs, the boards have built in protection and should be undamaged. If we exceed the input voltages significantly, there is a potential to permanently damage the board.


1. Go through the LabVIEW QuickStart Guide (on the course homepage). This will also be good review for those who have used LabVIEW before. Please note, the tutorial mentions a video, skip this step.

2. Write a Labview program that will count from 1 to 100, square the values, and print the results on a strip chart.


PC with LabVIEW software and PCI-1200 DAQ card

Interface cable

Signal generator

Digital multimeter


1. Review the LabVIEW QuickStart Guide used before the laboratory. This will also be a good review for those who have used LabVIEW in previous courses.

2. Enter the LabVIEW program (layout) schematically shown in Figure 30.2 Analog input using Labview and connect a signal generator to the analog input (ACH0). (Note: there is a pin diagram for the connector in the Labview tutorial section.) Start the signal generator with a low frequency sinusoidal wave. Use the ‘DAQ Configure’ software to test the circuitry and verify that your hardware is operational. Then run your Labview program. Record the observations seen on the screen.


Figure 30.2 Analog input using Labview

3. Run additional programs such as browsers, spreadsheets, etc. and see how this affects the data collection speed.

4. Connect the multimeter as shown in Figure 30.3 Analog output using Labview. Test the circuit using the ‘DAQ Configure’ utility. Enter the LabVIEW program schematically illustrated below and then run it. You should be able to control the output voltage from the screen using the mouse. Record your observations.

Figure 30.3 Analog output using Labview

5. Connect the digital input and output circuits to the DAQ card, as shown in Figure 30.4 Digital IO using Labview, and use the test panel to test the circuits. To do this, run the ‘DAQ Configure’ utility, double click on the ‘PCI-1200’, run the test panel window and ensure that the inputs and outputs are working correctly. Create the LabVIEW screen schematically illustrated below. This should allow you to scan an input switch and set an output light. When done, quit the program and run your LabVIEW program.

Figure 30.4 Digital IO using Labview

6. Use a counter output for a PWM device. Figure 30.5 PWM output using Labview shows a simple program to control the PWM output on the DAQ board. Enter the program and verify the operation with an Oscilloscope and DMM.

Figure 30.5 PWM output using Labview