Last month, we discussed the construction of the low-cost Elf microcomputer/trainer and gave some examples of simple programming. This month, we will describe hardware and how to make a low-cost LED replacement for the relatively expensive hex display and add a simple 8-bit I/O port. Then we'll add a 16- switch monitor that among other things will allow you to use a hex keyboard. We'll finish up the hardware section by showing how to use a 9-volt battery as power for a RAM circuit to hold a program for as long as six months.
When we're finished with the hardware details, it's back to the software continuing with our programming discussion.
The Hardware. The hex displays called for in the original Elf project can be replaced with a discrete LED circuit as shown in Fig. 1. You will need a CD4508 eight-bit register, eight low-current LED's, two 4049 hex inverters, and eight 470-ohm, ½-watt resistors. When the LED circuit is substituted for the hex displays, current consumption will be reduced by about 150 mA. The input comes from the data bus which formerly went to hex displays IC4 and IC5.
When you use the LED display, you must count the LED's to arrive at the hex number displayed. The upper four LED's form the first digit, the lower four, the second digit.
You can mount the LED's on the front panel. Be sure you carefully identify each. Also, when making the conversion, don't forget to modify the RUN switch circuit as shown.
You can connect an inexpensive cadmium-sulfide (CdS) cell between the EF1 line and ground. Be sure to use a photocell that has a dark resistance in excess of 200,000 ohms and a light resistance of less than 10,000 ohms. If you use any other photocell, you may have to increase the value of the resistor to pull up the EF1 line of the 1802 microprocessor. The high input impedance of the CMOS logic eliminates the need for photocell amplification. Also several photocell inputs can be used, each connected to a different flag (EF) line.
Using a photocell input, you can program the computer to start counting when an object moves past one photocell and stop counting when the object passes a second cell. This technique allows you to determine the speed of a moving object. It can also be used to count people, monitor motor speed, provide targets in a computer-controlled light gun or "eyes" for a computer-controlled robot, etc.
Magnetic reed switches, simple make/break switches, or similar devices can be connected to the computer via the flag-line inputs.
Several inexpensive methods of expanding the number of input and output lines can be used with this computer. One example is shown in Fig. 2. Here, a CD4058 IC is used in both the input and the output positions, while other IC's provide the necessary gating. A 69 instruction will store the values of the eight input lines in memory as a single byte.
In the output port section, a 61 instruction sets a memory byte into this port. The output port can control up to eight output lines, but you will have to add CD4050/CD4049 buffers if you wish to drive TTL loads. You can use