6
QEX – May/June 2010
Reprinted with permission © ARRL
error code and a switch to mouse mode. The
error code generates the appropriate number
of backspace characters to the beginning of
a word just entered. CW is translated into
ASCII text characters using a lookup table.
The paddle dot and dash contacts are con-
nected to pins RB4 and RB5, respectively, of
port B to take advantage of the change-on-
input interrupt feature. This allows the PIC to
go to sleep and consume practically no power
while waiting for an interrupt to occur when a
paddle lever is pressed.
Keyer paddle switch contact bounce
was probably the most challenging problem
of this project. A paper on switch bounce
convinced me that a keyer paddle without
any switch contacts, such as the Touchkeyer
paddle is necessary for this project.
39, 40
An
internal timer interrupt is used to measure
time between dots and dashes. Using port B
input interrupts and timer interrupts simpli-
fied the code.
The second module emulates a PS/2
keyboard using the PS/2 protocol. ASCII
characters are translated into PS/2 keyboard
scan codes using a lookup table. The lookup
table has every character of a PS/2 keyboard,
including those not found in Morse code.
It was a thrill to first see the letter Q gener-
ated by the PIC microcontroller appear in a
NotePad
text editor window!
The third module emulates a PS/2 stan-
dard three-button mouse. It generates PS/2
mouse button clicks and mouse pointer
movement from the keyer paddle input.
Clicking — briefly pressing — the left
paddle lever generates a left mouse button
click and, correspondingly, clicking the right
paddle lever generates a right mouse button
click. Mouse pointer movement is controlled
by pressing and holding the paddle lever:
the left contact controls the left-right mouse
pointer movement; the right contact con-
trols the up-down mouse pointer movement.
Pressing both sides moves the mouse pointer
along one diagonal direction or the other
diagonal direction. Hence, there are eight
possible mouse movement directions, and it
is possible to move the mouse pointer in an
Figure 4 — On the printed circuit board, there is a green LED in a transparent plastic lens
next to each cable connection. Hot glue is used to protect and secure the connections from
the PS/2 cables to the circuit board. The circles in the corners indicate where rubber feet are
placed under the circuit board.
Figure 5 — This photo shows a PICkit 2 programming cable wired using the connections
shown in Table 2. Hot glue protects the cable connections to a small prototyping board. The
dark colored dot on the top left corner of the perf board is oriented with the white triangle
on the PICkit 2.
Table 2B
Connections from the PICkit 2 Programmer Male Connector to a PS/2 Male
Connector PICkit 2 Programming Cable
Pin
PICkit 2 Male Connector
Pin
PS/2 Male Connector
1
–MCLR
2 –MCLR
2 V
DD
4 V
DD
3
ground
3 ground
4
ICSP PGD
1
ICSP data
5
ICSP PGC
5
ICSP clock
6
not connected
6
not connected
Table 2A
PS/2 Mouse Extension Cable
with Green Connectors and PS/2
Keyboard Extension Cable with
Purple Connectors
Pin
Wire Color
1 Black
2 Violet
3 Red
4 Green
5 Yellow
6 Blue