' ' Iambic Keyer ' ' Copyright (C) 2007 by David Gwillim, KB2TQX ' Email contact: kb2tqx at verizon.net ' ' 14 March 2007 13:30 ' ' Program Size = 231 bytes ' ' =============================================================== ' ' PICAXE 08M Chip Leg Assignments ' ------------------------------- ' ' ___ ' +5v--1-[o ]-8--GND ' SerIn--2-[ ]-7--SerOut/Out0 ' In4/Out4/ADC4--3-[08M]-6--In1/Out1/ADC1 ' In3/InfraIn--4-[___]-5--In2/Out2/ADC2 ' ' ' ' Hardware hookup for Iambic Keyer ' -------------------------------- ' ' ___ NOTE: ' +5v--1-[o ]-8--GND pin1, pin2, pin3 and pin4 are the program ' GND--2-[ ]-7--TX Keying Circuit names for the chip's physical connections. ' GND--[piezo]--3-[08M]-6----+ ' +--4-[___]-5--+ | ' | | | Hardware requires standard minimum hookup for Serin ' +5v-[10K]--+ +5v-[10K]--+ +--[10K]-+5v and Serout, if you want to reprogram the 08M in the ' | | | the circuit. See the PICAXE 08M docs in the PDF that ' ___ | ___ | | ___ comes with the the compiler for details. Otherwise ' GND--o o---+ GND--o o---+ +---o o--GND just connect leg 2 of the chip (Serin) to GND. ' MODE DAH DIT ' PUSH BUTTON PADDLE PADDLE ' ' ' Transmitter Keying Circuit ' -------------------------- ' ' G=Gate, S=Source, D=Drain ' ' ' ' +------------------------o TX KEY INPUT ' | ' ___ |S | ' [o ]-GND | --+ ' [ ]-7-----|| (2N7000 MOSFET) ' [08M] G| --+ ' [___] |D | ' | ' | ' GND-------+-------------------------o GND ' ' ' ================================================================================================== ' ' Character Keying Speeds Available ' --------------------------------- ' ' This table assumes the standard PARIS character timings. NOTE dit_length is in 10 mS units ' ' dah_length = 3 * dit_length ' element_delay (mS) = 10 * dit_length ' ' ' dit_length WPM dit_length WPM ' ---------- ---- ---------- ---- ' 2 68.2 17 8.0 ' 3 45.5 18 7.6 ' 4 34.1 19 7.2 ' 5 27.3 20 6.8 ' 6 22.7 21 6.5 ' 7 19.5 22 6.2 ' 8 17.0 23 5.9 ' 9 15.2 24 5.7 ' 10 13.6 25 5.5 ' 11 12.4 26 5.2 ' 12 11.4 27 5.1 ' 13 10.5 28 4.9 ' 14 9.7 ' 15 9.1 ' 16 8.5 ' ' ' =============================================================== ' ' ' Pitch table ' ----------- ' ' pitch_value Frequency Hz pitch_value Frequency Hz ' ----------- ------------ ----------- ------------ ' 67 199 92 336 ' 68 202 93 346 ' 69 205 94 357 ' 70 209 95 367 ' 71 213 96 379 ' 72 216 97 390 ' 73 221 98 404 ' 74 225 99 417 ' 75 229 100 433 ' 76 233 101 448 ' 77 238 102 466 ' 78 242 103 484 ' 79 247 104 503 ' 80 253 105 526 ' 81 258 106 549 ' 82 263 107 575 ' 83 269 108 604 ' 84 275 109 635 ' 85 282 110 671 ' 86 289 111 710 ' 87 296 112 754 ' 88 303 113 803 ' 89 310 114 861 ' 90 319 115 926 ' 91 328 116 1001 ' ' =============================================================== ' ' The Keyer program starts up at approximately 15 WPM.The transmitter keying output is only ' active in mode "K". ' ' The TX Keying circuit can consist of just a 2N7000 MOSFET. Connect the GATE to leg 7 of the ' 08M chip, connect the DRAIN to GND, and connect the SOURCE to the transmitter key input. ' ' Pressing the MODE button steps you through 3 modes: ' ' Pitch set (you hear a letter P in Morse). When in this mode, the DIT paddle increases the ' pitch of the Morse sound, and the DAH paddle decreases it. Squeezing both DIT and DAH paddles ' at the same time resets the pitch to the program default. ' ' Speed set (you hear a letter S in Morse). When in this mode, the DIT paddle increases the ' speed at which the Morse is sent, and the DAH paddle decreases it. Max = 45.5. Min = 4.9 ' Squeezing both the DIT and the DAH paddle at the same time resets the speed to the default. ' ' Pressing the MODE button one more time (you hear a letter K in Morse) puts you back in ' regular Keyer mode for sending. ' ' ' constants symbol tx_out = 0 ' pin for keying TX symbol a_pitch = 113 ' ack pitch - 113 = 803 Hz symbol a_dit = 8 ' ack dit speed - fixed at ~15 WPM symbol a_dah = 24 ' ack dah speed - fixed at ~15 WPM symbol tone_out = 4 ' pin for sidetone output ' variables symbol buttons = b0 ' w0 symbol pitch = b1 symbol tmp = b2 ' w1 symbol mode = b3 ' mode=0: normal, mode=16: adjust pitch, mode=32: adjust keyer speed symbol dit_speed = b4 ' w2 symbol dah_speed = b5 symbol last_elem = b6 ' w3 let pitch = a_pitch let dit_speed = a_dit ' start at approximately 15 WPM set_dah_speed: if dit_speed = 2 then let dit_speed = 3 ' limit highest speed to 45.5 WPM elseif dit_speed = 29 then let dit_speed = 28 ' limit lowest speed to 4.9 WPM endif let dah_speed = dit_speed * 3 if mode = 32 then didah main: let buttons = pins xor %00001110 ' allow for key contact bounce a little if buttons = 0 then let last_elem = 0 goto main endif pause 2 ' 2mS contact settle time let buttons = pins xor %00001110 + mode let tmp = 0 lookdown buttons,(0,2,4,6,8,24,40,18,20,22,34,36,38),tmp branch tmp,(main,dit,dah,didah,set_mode,set_mode,set_mode,pitch_up,pitch_down,pitch_reset,speed_up,speed_down,speed_reset) set_mode: if mode = 0 then mode = 16 ' send a P sound tone_out,(a_pitch,a_dit,0,a_dit,a_pitch,a_dah,0,a_dit,a_pitch,a_dah,0,a_dit,a_pitch,a_dit) elseif mode = 16 then mode = 32 'send an S sound tone_out,(a_pitch,a_dit,0,a_dit,a_pitch,a_dit,0,a_dit,a_pitch,a_dit) else mode = 0 ' send a K sound tone_out,(a_pitch,a_dah,0,a_dit,a_pitch,a_dit,0,a_dit,a_pitch,a_dah) endif goto dly pitch_reset: pause 200 let pitch = a_pitch goto didah pitch_up: inc pitch goto didah pitch_down: dec pitch goto didah speed_reset: let dit_speed = a_dit goto set_dah_speed speed_up: dec dit_speed goto set_dah_speed speed_down: inc dit_speed goto set_dah_speed dit: high tx_out sound tone_out,(pitch,dit_speed) low tx_out let last_elem = 1 goto dly didah: if last_elem = 1 then dah if mode = 0 then ' only key the transmitter in mode "K" high tx_out endif sound tone_out,(pitch,dit_speed) low tx_out sound tone_out,(0,dit_speed) dah: if mode = 0 then ' only key the transmitter in mode "K" high tx_out endif sound tone_out,(pitch,dah_speed) low tx_out let last_elem = 2 goto dly dly: sound tone_out,(0,dit_speed) goto main