A complete kit to go
with this article can
be purchased online
Nuts & Volts
or call our order
FIGURE 9. Hook-up diagram from
the Experimenter to the Mini-kit.
3. A key scan code is the raw scan data that represents
the row and column position of the depressed or released
key. It is generated by the PS/2 keyboard electronics as
a result of scanning its matrix of 80-101 keys.
The final step in this process is to look up the
corresponding ASCII representation associated with the
key code. Once this is done, the key can then be
displayed as ASCII on the LCD display. A flowchart of this
operation is shown in Figure 7. The functional library
elements for this component are:
• void initKBD(void) — Initialize timer interrupts, digital
I/O, and global variables for PS/2 operation.
• Char getcKBD(void) — Retrieve and return valid ASCII
codes as they have been received from the PS/2 keyboard.
The KBDReady flag must be set to indicate that a valid
key code has been received from the PS/2 keyboard.
The current key code is processed into ASCII. KBDReady
must be reset once the key has been processed.
The Mini-kit was introduced in the Dec ‘ 10 Nuts &
Volts article “Enhanced User Interface for the 16-bit
Experimenter.” It is recommended for use in this experiment
because it provides a convenient small board format with all
the necessary electronics and power supply (PS/2 keyboard
interface and a +5V DC regulator) to integrate the PS/2
with the Experimenter. The kit also has an additional bonus
in that it contains a rotary encoder knob that we can use
for an additional data source (see Figure 8). We will
experiment with both inputs. The +5V regulator is necessary
to provide the required voltage levels for the PS/2 interface
(to power up the keyboard and provide proper voltage levels
for the PS/2 interface). Its 5V output is also available to the
user to power up any external +5V hardware. As a side note,
if you intend to use the Experimenter from an unregulated
supply, consider using the Mini-kit +5V regulator output
for the Experimenter. The hook-up diagram shows this.
The Experimenter itself is a + 3.3V device but has +5V
tolerant lines that are available for connecting and
sampling the PS/2 data and the clock. Recommended
hook-up lines are shown in Figure 9.
Once you’ve completed the integration of the Mini-kit
to the Experimenter hookups (as per Figure 9), proceed to
the keyboard demo. Open the keyboard folder and then
invoke workspace Keyboard.mcp. Compile and program/
download this workspace into the Experimenter. You
should see the start up screen as shown in Figure 10. This
screen times out to a blank screen that accepts any characters
typed in from the PS/2 display. Typing beyond the limits of
the LCD display will cause the characters to wrap around,
starting at the initial display position of 0,0. The F10 key
will clear the display and be in position for a new character
October 2011 53