'MEMORY KEYER 5 v.5-1 10.7.2013 'with Picaxe-14M2 560/2048 bytes OH1TV '--------------------------------------------------------------------------------- 'Iambic A keyer + 5 preprogrammed messages from memory 'Programming with Picaxe Editor. 'Speed control is with potentiometer, dot length set in abt 1ms steps 'Clock 32MHz 'Sidetone is made with pulsout commands inside the marks 'Dit ja Dah routines are common for paddle and memory modes 'All messages can be stopped any time with interruption 'Message composition on 3 levels '--------------------------------------------------------------------------------- 'PINOUT of Picaxe 14M2 'Pin1 = V+ = +5V 'Pin2 = C.5 = programming in 'Pin3 = C.4 = voltage for speed control 'Pin4 = C.3 = paddle-Dah 'Pin5 = C.2 = paddle-Dit 'Pin6 = C.1 = sidetone speaker 'Pin7 = C.0 = interruption = CANCEL 'Pin8 = B.5 = message1 = OH1TV 'Pin9 = B.4 = message2 = OH1O 'Pin10= B.3 = message5 = OP PEKKA 'Pin11= B.2 = message4 = R 5NN TU 'Pin12= B.1 = message3 = OH1WX 'Pin13= B.0 = programming out,keying tx 'Pin14= 0V = ground 'VARIABLES USED 'b0 = Mark register 'b4 = lookup offset for level 3 'b5 = lookup offset for level 2 'b8 = potentiometer voltage 'w5 = dit time (b10,b11) 9 'w6 = dah time (b12,b13) 'w7 = space between char's (b14,b15) time 'w8 = space between words (b16,b17) time 'w9 = for-loop counter (b18,b19) for level 1 'w10= space between marks (b20,b21) time '---------------------------------------------------------------------------------- Symbol Mark = b0 'set register for Mark setint %00000000,%00000001 'interrupt when pin C.0 is 0 setfreq m32 'set processor clock to 32MHz Start: 'TIMING --------------------------------------------------------------------------- readADC C.4, b8 'read potentiometer voltage for speed w5 = b8/3+35 'dit time, scale 35 to 120 time units w6 = w5*3+2 'dah time, 3 dits w10= w5 'space between marks w7 = w5*3 'space between characters 1+3=4- dits w8 = w5*7 'space between words 1+7=8- dits 'READ BUTTONS and PADDLE ---------------------------------------------------------- if PinC.2 = 0 then gosub _dit 'start dit if PinB.1 = 0 then gosub _oh1wx 'message3 if PinB.2 = 0 then gosub _r599tu 'message4 if PinB.3 = 0 then gosub _op 'message5 if PinB.4 = 0 then gosub _oh1o 'message2 if PinB.5 = 0 then gosub _oh1tv 'message1 if PinC.3 = 0 then gosub _dah 'start dah goto Start 'LEVEL 3 -------------------------------------------------------------------------- _oh1tv: 'OH1TV + word space for b4 = 0 to 7 'number of Marks in the message (8) lookup b4,(4,3,0,1,1,1,3,2),Mark on Mark gosub _chs,_dit,_ws,_dah,_oh1 'goto lower level routines next 'loop back to get next return _oh1o: 'OH1O + word space for b4 = 0 to 4 lookup b4,(4,3,3,3,2),Mark on Mark gosub _chs,_dit,_ws,_dah,_oh1 next return _oh1wx: 'OH1WX + ws for b4 = 0 to 9 lookup b4,(4,1,3,3,0,3,1,1,3,2),Mark on Mark gosub _chs,_dit,_ws,_dah,_oh1 next return 'LEVEL 2 -------------------------------------------------------------------------- _r599tu: 'R 5NN TU for b5 = 0 to 20 lookup b5,(1,3,1,2,1,1,1,1,1,0,3,1,0,3,1,2,3,0,1,1,3),Mark on Mark gosub _chs,_dit,_ws,_dah 'goto level 1 routines next return _op: 'OP PEKKA+ws for b5 = 0 to 26 lookup b5,(3,3,3,0,1,3,3,1,2,1,3,3,1,0,1,0,3,1,3,0,3,1,3,0,1,3,2),Mark on Mark gosub _chs,_dit,_ws,_dah next return _kp10iu: 'KP10iu+ws for b5 = 0 to 27 lookup b5,(3,1,3,0,1,3,3,1,0,1,3,3,3,3,0,3,3,3,3,3,0,1,1,0,1,1,3,2),Mark on Mark gosub _chs,_dit,_ws,_dah next return _oh1: 'OH1+cs for b5 = 0 to 14 lookup b5,(3,3,3,0,1,1,1,1,0,1,3,3,3,3,0),Mark on Mark gosub _chs,_dit,_ws,_dah next return 'LEVEL 1 -------------------------------------------------------------------------- _chs: '0,make additional space between characters for w9 = 0 to w7 pause 4 next return _dit: '1,make Dit and sidetone high B.0 'dit starts for w9 = 0 to w5 pulsout C.1,400 'sidetone cycle next low B.0 'dit ends for w9 = 0 to w10 'make space between marks pause 4 next return _ws: '2,make additional space between words for w9 = 0 to w8 pause 4 next return _dah: '3,make Dah and sidetone high B.0 'dah starts for w9 = 0 to w6 pulsout C.1,400 'sidetone cycle next low B.0 'dah ends for w9 = 0 to w10 'make space between marks pause 4 next return '------------------------------------------------------------------------------- Interrupt: 'stop the message b4=30 'set level 3 lookup offset above max b5=30 'set level 2 lookup offset above max w9=1000 'set level 1 pulsout counter above max setint %00000000,%00000001 'interrupt when pin C.0 is 0 return '-------------------------------------------------------------------------------- 'end