background image

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

–MCLR 

2 –MCLR

2 V

DD

 

4 V

DD

ground 

3 ground

ICSP PGD 

ICSP data

ICSP PGC 

ICSP clock

not connected 

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

Содержание Keyer Paddle

Страница 1: ...I was looking I would write a pro gram that runs on a PIC and that emulates a PS 2 keyboard using a keyer paddle for input Later on in the project I wondered if it was also possible to emulate a PS 2...

Страница 2: ...ands the key board to light its Caps Lock LED when the Caps Lock key is pressed The PS 2 Mouse Protocol The standard PS 2 mouse device sends the host its movement and button informa tion as a three by...

Страница 3: ...ternal 8 MHz clock within the PIC is used instead PIC Development Tools For the PIC programmer I used the Microchip PICkit 2 programmer debug ger 27 The PICkit 2 is inexpensive and was adequate for th...

Страница 4: ...ddle 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 mo...

Страница 5: ...n and purple connectors are connected to the corresponding purple and green female con nectors of the PS 2 keyboard and mouse to USB adapter Table 1 provides the parts list of readily available compon...

Страница 6: ...8509 www sparkfun com commerce product_info php products_id 8509 12 SparkFun Electronics MiniDIN 6 Pin Connector Breakout SKU PRT 08651 www sparkfun com commerce prod uct_info php products_id 8651 13...

Страница 7: ...ucts com embeddedcbook htm 33 Martin P Bates Programming 8 bit PIC Microcontrollers in C with Interactive Hardware Simulation Oxford UK Newnes Press 2008 ISBN 9780750689601 34 Chuck Hellebuyck Beginne...

Отзывы: