background image

  QEX – May/June  2010   

3

 

Reprinted with permission © ARRL

David Bern, W2LNX

8809 Cold Spring Rd, Potomac, MD 20854; [email protected]

A PS/2 Keyer: Using a Keyer 

Paddle to Emulate a PS/2 

Keyboard and Mouse

1

Notes appear on page 8.

Would you like to operate your computer without a keyboard? 

How about RTTY or PSK-31 without a keyboard? Now you can.

This article describes my first program-

ming project with a Microchip PIC

®

 micro-

controller. The program for this project, 

written in C, emulates a PS/2 keyboard and 

a PS/2 mouse using a CW keyer paddle for 

input.

Note: an earlier version of this article was 

published in The 28th Annual ARRL and 
TAPR Digital Communications Conference 
Proceedings

. The 28

th

 Annual DCC was 

held in Chicago, Illinois on September 

25-27, 2009.

Over the past several years, I became 

interested in learning how to program 

Microchip PIC microcontrollers and I began 

to look for an interesting project. I am an 

experienced  C programmer, but I knew 

nothing about PIC microcontroller program-

ming. My criteria for the project was that it 

needed to have a well defined input, a well 

defined output, and the circuit needed to 

consist solely of a PIC microcontroller with 

some light emitting diodes (LED). And, 

importantly, it needed to be written in C

At the 26

th

 DCC, Milt Cram, W8NUE 

and George Heron, N2APB introduced their 

NUE-PSK digital modem.

1

 The full details 

of the NUE-PSK modem were published 

in the Mar/Apr 2009 issue of QEX (NUE-

PSK Digital Modem Enables PSK31 Field 

Operation Without Using a PC!), along with 

a summary article in the March 2008 issue 

of QST. The NUE-PSK modem is a small 

device that provides portable PSK31 (and 

now RTTY) operation without the use of a 

personal computer. It does, however, require 

a PS/2 keyboard for entering text. It occurred 

to me that it could be more portable if the 

large PS/2 keyboard were replaced with a 

CW keyer paddle. A PIC microcontroller 

would translate CW input sent on the paddle 

into the output from a standard PS/2 key-

board. Hence, I found the idea for the project 

for which 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 mouse 

with only two switch contacts and no other 

moving parts.

Background

Morse Code

Morse code input is defined in the ITU 

recommendation on the international Morse 

code and is further described in an article in 

Wikipedia.

2, 3

 The CW character and word 

timings needed for this project are the length 

of time of a dash relative to a dot, the length 

of time between dots and dashes in a letter, 

the length of time between letters and the 

length of time between words.

The PS/2 Protocol

The output of a PS/2 keyboard and a PS/2 

mouse follow the PS/2 protocol, which was 

originally described in the IBM Personal 
System/2 Hardware Technical Reference

in the sections on the “101 and 102 Key 

Keyboard” and the “Keyboard and Auxiliary 

Device Controller” sections of the computer 

reference manual, respectively.

4, 5

 Articles on 

the Internet about the PS/2 protocol, the PS/2 

keyboard protocol, and the PS/2 mouse pro-

tocol were most helpful.

6, 7, 8

 More recently, 

an article describing a keyboard-game inter-

face using the PS/2 protocol appeared in 
Nuts and Volts

 magazine.

9

The physical PS/2 interface, shown in 

Figure 1, used for the keyboard and mouse 

connectors uses the PS/2 protocol. The PS/2 

protocol is a two way synchronous protocol 

used to communicate between a host and a 

device. (See Note 6.) A host, typically, is a 

personal computer and a device, typically, 

is a keyboard or a mouse. In addition to a 

clock line and a data line, there is a 5 V line 

and a ground line. The PS/2 protocol uses 

the clock line and the data line for sending 

data. The frequency of the clock is within 

the range of 10 to 16.7 kHz. Data is sent as 

an 11 bit frame, starting with a zero start bit, 

the eight data bits, with the least significant 

bit first, an odd parity bit and one stop bit. 

The device always generates the clock sig-

5

6

3

4

1

2

6

5

4

3

2

1

Male

(Plug)

Female

(Socket)

6-pin Mini-DIN (PS/2)

1 - Data 

 

4 - Vcc (+5 V) 

2 - Not Used 

5 - Clock

3 - Ground  

6 - Not Used

Figure 1 — The PS/2 ports for the keyboard 

and mouse on personal computers use six 

pin mini-DIN connectors.

Содержание 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...

Отзывы: