MAG-85 Construction:

LCD display showing interrupt messages

LCD Code Plus Interrupts



LCD and Interrupts

To prepare for adding a keyboard we combine our LCD test with code to service the external interrupts. The keyboard will use one of these interrupts.

Mix and Match

Preparing for a Keyboard

To keep things simple we've left interrupts out of our initial LCD display tests. Now it's time to add interrupts back in to our software. This prepares the way for adding the keyboard, since the keyboard controller will use an interrupt to let the MAG-85 know that a key has been pressed and data is waiting.

Showing Interrupts on the LCD

Now that we have a display to use, we can print different things on it for different interrupts. Using our SOUT (String OUT) procedure we can send out different strings for each interrupt very easily. The main program will initialize the system, including preparing the LCD for data and enabling the external interrupts. Then the program will sit in a waiting loop, blinking the SOD LED on and off so that we have a "heartbeat" to see that the computer is running its program and not halted somewhere.

Our software will also include vectors for each of the interrupts we use (TRAP, RST5.5, RST6.5 and RST7.5) that will point to short interrupt handler subprograms. Each of the interrupt handlers will set up the HL register pair as a pointer to the start of that interrupt's text string, call the SOUT procedure to print the string, then re-enable interrupts and return to the heartbeat loop.

In one version of the program, the interrupts can be called again and again as long as the interrupt's key is pressed. In a slightly more sophisticated version, each interrupt handler will wait until its key is released before returning to the heartbeat program.

Keyboard Prep

The keyboard controller will use RST6.5 to alert the 8085 to the fact that there is key data waiting. A useful thing to do when putting together a new system is to keep the number of changes made at any one time down to an absolute minimum. Using this program, it's possible to first get this piece of software running and make sure that everything works as planned with the software first. Then the new components for the keyboard can be installed and basic function can be tested without any software changes. After the system has passed this test, then the software can be updated to add more features to the keyboard interface.

The Keys

For this test your system should have debounced keyswitches on the four external interrupt inputs TRAP, RST5.5, RST6.5, RST7.5. This is the same as was used in our initial interrupt test. If you don't have enough debounced switches to connect to all interrupts at once, test each interrupt by powering off and connecting the switches you have to each interrupt input in turn. Don't forget to tie the lines that you don't have switches on to ground to keep them from floating high and causing unwanted interrupts of their own.


Part 2: The Software >>

LCD/Interrupt Test Page: 1  2


<< Mag-85 Home