Vanderbilt University


Interfacing external devices with the Vandymatic

J. Driscoll

Overview

To connect to an external device to the VandyMatic for input/output, use the existing ports (PORTA, PORTC, etc.) on the HC11 whenever possible. That is, don't build a new port unless it's strictly necessary. Consult with your lab TAs or class instructor if you're thinking about it.

For the case of output lines, the port lines may not have the necessary current sourcing/sinking capability to drive the external lines. For example, an output line cannot drive an LED, but it could serve as input to a TTL logic chip. An output line can only be used as an input to a finite number of TTL gates: The maximum current drain per PORT pin is 25 mA. This can drive quite a few TTL gates (25mA is roughly equal to 25 TTL gates).

To provide more current sourcing/sinking, the output lines of the port should be connected to the inputs of a buffer chip. The outputs of this buffer chip will have the same logic levels as the inputs, but will have the voltage needed to drive the external lines. So, the external lines should be connected to the outputs of this buffer chip. For input lines of the port, voltages in the range 0V to 5V are required. If the external inputs have different voltage ranges, a buffer chip can be used to convert the voltages. The external input lines should connect to a buffer chip's input lines. The buffer chip's output lines are then connected to the port lines. This indirect connection protects the port lines from damaging voltage levels present on the external input lines, but that are handled safely by the buffer chip.

You should be able to use the existing ports for your external I/O needs: if a single port doesn't have enough lines, then use the lines of several ports. The only interfacing circuitry needed is buffer chips, and you only need those under certain circumstances (see above). If, for some reason, the existing ports won't serve your purpose, then you can build custom I/O ports (see the section on building custom ports).

Note that if a port doesn't have enough lines to interface with an external device, it is okay to distribute the connections across several ports. However, you must be careful with timing. For example, assume that you need to send sixteen bits to an external device, and so you use two (8 bit) ports. The HC11 can only write to one port at a time. That is, the first eight bits will be placed on one port, and then the second eight bits will be written on the second port. You have to be sure that the external device doesn't read halfway through these two writes, or half of the sixteen bits will be invalid. A solution to this is to use an additional output line that is monitored by the external device. When the HC11 has completed all of the writing, it pulses this extra line. When the external device receives this pulse, it knows that it is okay to read from the ports.

Availability of Ports

You need to find out some information about the ports. Specifically, which ports are available, what lines of these ports are available, and which lines are input, output, or bi-directional. If you check a textbook or Motorola documentation on the HC11, you'll find out what ports are available, and what pins are available, and what pins are input, output, or bi-directional (and how to set the direction).

That is, you need to first go through the specs of the ports, in detail. While indeed there are five ports, some of those port signals are shared with other functions. For instance, PORTA lines are sharing pins with TIMER functions. So you either use them as timer pins, or port pins, but not at the same time. Read very carefully either the EECE 218 textbook, or the Motorola docs.

The problem is that the VandyMatic (which uses the HC11) uses up some of the available ports and lines. So, you need to find out what the VandyMatic is doing.

To find this out, look at the Vandymatic circuit diagrams, and find out which port lines come out to the header (not all of them), and which are the ones that are used by other functions. (e.g. PORTD is used by the serial IO, you can't use it!). Some of the ports are fixed inputs, some are fixed outputs, and some are bi-directional: you can program their direction from software (these are only PORTC and PORTD). On the HC11 card, on the inner side of the cover, there is a diagram showing these directions.

It is recommended looking through your EECE 218 lab material: in several labs, you used ports. Check to see what ports (and which lines of those ports) you used. If you used them then, you can use them now.

Click here for more detailed information on Using the HC11 Ports.

Click here for more detailed information on Building Custom Ports.


| EE-218  Home page | Syllabus | Schedule | Lab News | Faculty | Contact Information | Lab Info | Project |


Department of Electrical Engineering and Computer Science
Box 1824 Station B
Nashville, TN 37235
Phone: 322-2771
Fax: 343-6702


 | Search | Site Index | People Finder | Phone Directory | VUnet | VUmail | VU Library | Help |


This page is better viewed with

Last Updated: Saturday, March 05, 2005

Juan J. Rodriguez-Moscoso

Copyright © 2001 Vanderbilt University