PHY 406 - Microprocessor Interfacing Techniques

Module 3 - Digital Input and Output

Objective

In module 1 we looked some very simple analog input and output. In this module we do some similar things for digital input and output. Our "model" is to control a small keypad and display unit.

Preparation

You will need the following VIs

Functions>>Data Acquisition>>Digital I/O>>Read From Digital Port.vi

Functions>>Data Acquisition>>Digital I/O>>Write To Digital Port.vi

Make sure (by asking if necessary) that you understand the circuit diagram for the keypad and display interface keypad.pdf

This module will also tax your knowledge of LabVIEW programming. Two very useful concepts that you should be sure you understand are the use of "sub-VIs" to encapsulate code so that you don't have to program it again or have it cluttering up your screen, and the concept of "constant arrays" which allow you to deal with "if the number I get is A, then the result I want is B" when there is no simple mathematical relationship (or there is, but it's a pain to compute) between A and B

Equipment

You will need the keypad and LED display interface which is kept in the cupboard. All the interfaces should be identical so there should be no need to record the number of the interface unless the thing doesn't work!

There has been one problem with a computer failing to run the interface because of a fuse failure in the interface. If it doesn't seem to be working at all - no lights, no numbers - try running the test program to see if it is the interface or your program

The interface consists of a single digit LED display which has seven segments (hence it is often called a "seven-segment" display) and a decimal point each of which can be individually controlled from single bits of the PB port which is an output port. There is a also a 4x4 keypad which is scanned by four bits of the PB port and produces results in the lower four bits of the PA input port. The upper 4 bits of that port are always 0.

Your mission, Jim, should you decide to accept it, is to make this interface work in a logical manner.

Digital I/O

Advanced

This section is for the intelligent/bored or otherwise fascinated. There are no marks for this section - only the satisfaction of solving a problem or two.

Notes

This problem of things being used for two purposes which interfere with each other is common. Although it would be desirable for you to always have "one thing one job" it isn't always economically feasible. Sometimes you have to compromise and make the best of it.