AT Keyboard Interface with Morse Code Support V1.02

for Microchip PIC16F84

Table of Contents [Toc]

   How it works
   Supported Morse Alphabet
Project Resources
   Available PIC Assembler Code
   Schematic, Data Sheets, Pinout
   User-specific Customization

Concept   [Toc] [Top]

This implementation contains the complete fetch and decoding of AT keyboard scan patterns as well as RS232 transmission of ASCII characters to the RS232 target device.
Additional Morse port for pulse-width modulated (PWM) Morse code output. Further, there is also the ability to enable acoustic Morse code feedback through a Piezo beeper (parameterizable feature).

How it works   [Toc] [Top]

Basically, it works in the same way as the AT Keyboard Interface V1xx.

Morse code feature:
All legal ASCII characters specified within the Morse alphabet are translated to a 16 bit pattern through a look-up table. Within these bit patterns, two consecutive ones followed by a zero indicate a dash, a dot is encoded as single one followed by a zero.
The Morse code has different lengths for encoding, e.g.   e = .      b = -...      1 = .----      ? = ..--..    therefore 16 bits are necessary to support all of them. For instance, 'b' is encoded in 16 bits as b'1101_0101_0000_0000'. Subsequent zeros at the end within a pattern are considered as termination and are ignored. The Morse pattern is signaled as pulse-width modulated stream at the Morse port, active high.

Parameterization of Piezo beeper support (acoustic Morse code feedback) with constant BEEP_ENABLE within section 'Parameterization' in program code.

Customization of Morse code speed at assemble time (length of dot, length of dash, wait period in between dash and dot, wait period in between two characters) can be done using constants within section 'Constant declaration' in program code. No dynamic speed control during run time (not yet).

Since Morse code transmission needs some time for each character - especially numbers - multiple typed characters at the AT keyboard are stalled within the keyboard internal TX buffer whenever the PIC microcontroller pulls down the open-collector clock line (between keyboard and PIC) for stalling. With this scheme, up to 7 keyboard characters can be queued up without data loss (in my no-name 10$ keyboard). This queuing mechanism is maybe keyboard-dependent.

Translation from keyboard ASCII characters to Morse code is done using a look-up table. The look-up table for the ASCII to 16 bit Morse pattern conversion has been created using an Excel 97 work sheet ( and Visual Basic macros. The supported Morse alphabet is listed in this table below.

The 16 bit Morse code look-up table for Microchip PIC assembler has been
created automatically using an Excel 97 work sheet and Visual Basic macros.


Specifications   [Toc] [Top]

Processor: Microchip PIC 16F84
Clock Frequency: 4 MHz crystal
Throughput: 1 MIPS
RS232 Baud Rate: 9600 baud, 8 bit, no parity, 1 stopbit
Keyboard Routine Features: Capability of uni-directional communication between microcontroller and keyboard
Acquisition Methodology: Preemptive, interrupt-based keyboard scan pattern acquisition, decoding to ASCII characters during normal operation mode activated by ready flag
Code Size of entire Program: 800 instruction words
Required Hardware: AT keyboard, PS/2 connector, MAX232
Optional Hardware: Piezo beeper with decoupling capacitor
Required Software: RS232 terminal software


Supported Morse Alphabet   [Toc] [Top]

Char Morse code
A .-
B -...
C -.-.
D -..
E .
F ..-.
G --.
H ....
I ..
J .---
K -.-
L .-..
M --
Char Morse code
N -.
O ---
P .--.
Q --.-
R .-.
S ...
T -
U ..-
V ...-
W .--
X -..-
Y -.--
Z --..
Char Morse code
0 -----
1 .----
2 ..---
3 ...--
4 ....-
5 .....
6 -....
7 --...
8 ---..
9 ----.
Char Morse code
" .-..-.
' .----.
( ) -.--.-
, --..--
- -....-
. .-.-.-
: ---...
? ..--..

Supported Morse alphabet within this Microchip PIC project.

Features   [Toc] [Top]


Limitations   [Toc] [Top]

Same as within AT Keyboard Interface V1.03.


Project Resources   [Toc] [Top]

Available Microchip PIC Assembler Code   [Toc] [Top]

Main File Main Keyboard Decode Lookup Table SHIFT Keyboard Decode Lookup Table HEX Files
Latest version:
English 'codepage' (QWERTY)
View: eng_main.html
Download: eng_main.asm
English 'codepage' (QWERTY)
View: eng_shif.html
Download: eng_shif.asm

QWERTY 'codepage':

QWERTZ 'codepage':

Modified Swiss German 'codepage' (QWERTZ)
View: ger_main.html
Download: ger_main.asm
Modified Swiss German 'codepage' (QWERTZ)
View: ger_shif.html
Download: ger_shif.asm
The above programs need additional include files (modules) to get successfully assembled: m_bank.asm, m_wait.asm, m_rs096.asm.
For those, who are not familiar with interfacing a PIC to the RS232 using a MAX232:   RS232-Interface.pdf   (9.7 kB)


Schematic, Data Sheets and Pinout   [Toc] [Top]

AT Keyboard Specification (PDF, 189 kB)

Basically, the schematic of the AT Keyboard Interface with Morse Code Support V1.02 is the same as the AT Keyboard Interface V1.04:   Keyboard_V1xx.pdf
The only additional features:

The 16 bit Morse code look-up table for Microchip PIC assembler as Excel 97 work sheet with Visual Basic macros:

Download ASCII Character Map: ASCII-Map.pdf

You can get the description of the various keyboard connectors <here>.


User-specific Customization   [Toc] [Top]

For a high level view, please refer to the section 'How it works' above.
Basically the same customization as for AT Keyboard Interface V1xx applies to this implementation.

If you apply changes to the existing code, you may need to change the ORG directives in order to realign the assembler code properly.


Last updated: 2004/04/19

[Toc] [Top]

If you see only this page in your browser window,
click here
to get the entire site.