Morse Code Decoding @8WPM with a PICAXE 08M2

Morse Code Decoding @10WPM with a PICAXE 08M2

See the 20X2 in action:
2011 Aug 26: Updated code base to sync with 20X2 code. Eliminated GOTO and optimized algorithm. These changes reduced the code size while increasing the performance from 8WPM to 10WPM based on ARRL training files. With the 20X2, speeds of 15WPM+ can be achieved (29WPM/15Farnsworth.) You can feed the NPN-clipper circuit with the output of a 700Hz-800Hz Morse oscillator (NE555, etc.) attached to a key for instant visual feedback while learning Morse Code.

The 08M2 running at 32MHz and using the Pulsin command can decode 10WPM Morse Code in a similar manner to the 20X2. However, since the 20X2 using Pulsin at 64MHz "times out" much quicker and the WPM that can be handled is much higher... the 20X2 works without modification of code for 5WPM to 15WPM (higher if Farnsworth spacing is being used.)

However, error free decoding of 10WPM on a 08M2 is kind of a fun project. The Morse signal is taken from the Wikipedia article on Morse Code and the 8WPM is the alphabet, A-Z. A single transistor NPN transistor is utilized for clipping the audio output from your PC... a value of 0.75V - 0.8V is required to saturate the NPN and adequately clip the waveform so that Pulsin can decode the signal. My previous article on Morse using the 20X2 has the SPICE definition of the NPN circuit, so I will not repeat here. If you wish to do anything more seriously than just play around, you will need to build a much better amplifier and clipping circuit. Input from the NPN collector goes to the 08m2 pin C.3 and you can tie a LED to C.2 through a 100-150 ohm resistor to +5V.

Basic NPN clipper: (see 20X2 thread for JPG of circuit)

+5V through 10K to Collector of NPN
Collector goes to pin C.3 of PICAXE 08M2
GND goes to Emitter of NPN
GND goes to shield of earphone jack on PC
Base goes through 2.2K resistor to earphone jack center

As with the 20X2 code, I'm using my Magic Morse DAH-Weighted algorithm. A PDF can be found in the 20X2 article that explains the scheme.

- Ray


Last edited:
New lookup table for Magic Morse

I have modified the EEPROM table to include most of the Prosigns. Here is the updated DATA:

EEPROM 0, (0,"E","I","S","H","5",0,0,"e") ' e = ERROR = di di di di di di di di
'EMPTY 6, 7
EEPROM 9, ("T","N","D","B","6","-",0,0,0)
'EMPTY 15, 16, 17
EEPROM 18,("A","R","L","w",0,0,0,0) ' w = wait
'EMPTY 22, 23, 24, 25
EEPROM 26,("M","G","Z","7",0,0,0,0,0)
'EMPTY 30, 31, 32, 33, 34
EEPROM 35,("U","F",0,0,0,0)
'EMPTY 37, 38, 39, 40
EEPROM 41,("i",0)				'i == INVITE
EEPROM 43,("K","C",0,0,0,0,0,0)
'EMPTY 45, 46 ,47, 48, 49, 50
EEPROM 51,("W","P",0,0,0,0,0,0)
'EMPTY 53, 54, 55, 56, 57, 58
EEPROM 59,("O",0)
EEPROM 61,("8",":",0,0,0,0,0)
'EMPTY 63, 64, 65, 66, 67
EEPROM 68,("V","u","]","$",0,0,0,0)	'u == UNDERSTOOD and ]== EndOfWork
'EMPTY 72, 73, 74, 75
EEPROM 76,("X","/",0,0,0,0,0,0,0,"+",".",0,0,0,0,0)	'SLASH=77 and PERIOD=86
'EMPTY 78, 79, 80, 81, 82, 83, 84, 86, 87, 88, 89, 90, 91
EEPROM 92,("Q",0,".",0,0,0,0,0,0)
EEPROM 101,("!","?",0,0,0,0,0)		'QUESTION MARK=102
'EMPTY 93, 94, 95, 96, 97, 98, 99, 100, 102, 103, 104, 105, 106, 107
EEPROM 108,("Y","(",")",0,0,0,0,0)
'EMPTY 111, 112, 113, 114, 115
EEPROM 116,("J",0,0,0,0,0,0,0,0)
'EMPTY 117, 118, 119, 120, 121, 122, 123, 124
EEPROM 125, ("9",0,0,0,0,0,0,0)
'EMPTY 126, 127, 128, 129, 130, 131, 132
EEPROM 133, ("4") : EEPROM 134, ("(") : EEPROM 135, ("c") : EEPROM 136, (")")
EEPROM 137, (" ")
EEPROM 161, (0,0,0,0,0,0,0,0,0,0,0,0,"[",";",0,0,0,0,0,0,0)	' > == STARTING
'EMPTY 160- 172, 175 - 181
EEPROM 182, ("@")
'EMPTY 183 - 196
EEPROM 197, ("3")
'EMPTY 198 - 228
EEPROM 229, ("2",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
'EMPTY 230 - 244
EEPROM 245, ("1","'",0,0,0,0,0,0)
'EMPTY 246 - 252
EEPROM 253, ("0","'",0)
'EMPTY 255
The 08M2 decode algorithm has not changed. The ability to include 6-bit prosigns in a 5-bit lookup pointer results from the pointer wrap-around.
Magic Morse Prosigns.JPG

If anyone is interested in the from-scratch construction of a PICAXE20X2 Magic Morse, here are the PIX and Docs...

The PICAXE08M2 tops-out at 10WPM However the 20X2 at 64MHz continues to perform well. I utilized the following test files with the 20X2 implementation and all files were copied at 100% accuracy-
ARRL training files (MP3): 010405WPM, 010410WPM, 012713WPM, 012715WPM, 012718WPM, 020920WPM, and 022325WPM. Manual keying on the attached key with the 555 time code-practice-oscillator is accurate from 05WPM to approximately 29WPM assuming that Farnsworth spacing (no faster than 15WPM) is used between characters. The ARRL files were processed 05WPM-15WPM with the algorithm constant at "5" which is the default setting and the 18WPM-20WPM were copied with the constant at "4" and the 25WPM had the constant set to "3". The constant is selectable from the single MODE switch which performs 3 separate functions and new values of the constant are written to EEPROM.