'MEMORY KEYER 12 v.3 9.7.2014 'with Picaxe-20X2 1361/4096 bytes OH1TV '------------------------------------------------------------------------------ 'Iambic A keyer + 12 preprogrammed messages from memory, keypad selection '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 keyer and memory modes 'All messages can be stopped any time with interruption 'Messages are formed on up to four layers 'PICAXE 20X2 PINOUT MORSE TIMING ideal here 'Pin1 =V+ = +5V Dot length 1 1 'Pin2 =programming in Dash length 3 3 'Pin3 =C.7 =voltage for speed control Space between marks 1 1 'Pin4 =C.6 =paddle-Dah Space between chrs 3 3+ 'Pin5 =C.5 =paddle-Dit Space between words 7 7+ 'Pin6 =C.4 = 'Pin7 =C.3 =interruption 'Pin8 =C.2 =pause, no use 'Pin9 =C.1 =keying out 'Pin10=C.0 =sidetone speaker ' 'Pin11=B.7 =keypad 4. line 'Pin12=B.6 =keypad 3. line 'Pin13=B.5 =keypad 2. line 'Pin14=B.4 =keypad 1. line 'Pin15=B.3 = 'Pin16=B.2 =keypad left row 'Pin17=B.1 =keypad center row 'Pin18=B.0 =keypad right row 'Pin19=A.0 =programming out 'Pin20=0V =ground 'VARIABLES used (available b0-b55, w0-w27) 'b0 = Mark register 'b3 = lookup offset for level 4 'b4 = lookup offset for level 3 'b5 = lookup offset for level 2 'b8 = potentiometer voltage 'w5 = dit time (b10,b11) '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,%00001000 'interrupt when pin C.3 is 0 setfreq m32 Start: 'read inputs 'TIMING----------------------------------------------------------------------- readADC C.7, b8 'read potentiometer voltage for speed w5 =b8*70/255+30 'dit time, scale 30-100 units w6 =w5*3+2 'dah time, 3 dits w10=w5 'space between marks, 1 dit w7 =w5*2+5 'space btw chrs 1+2+(2)=3+ dits (4 units extra) w8 =w5*6+9 'space btw words 1+6+(2)=7+ dits (4 units extra) 'KEYPAD and PADDLE ------------------------------------------------------------ if PinC.5 = 0 then gosub _dit 'start dit high B.0:low B.1:low B.2 'read right hand row if PinB.4 =1 then gosub _oh1wx 'button 3 if PinB.5 =1 then gosub _cq_wx 'button 6 if PinB.6 =1 then gosub _qrz 'button 9 if PinB.7 =1 then gosub _qth 'button # low B.0:high B.1:low B.2 'read center row of keypad if PinB.4 =1 then gosub _oh1o 'button 2 if PinB.5 =1 then gosub _cq_o 'button 5 if PinB.6 =1 then gosub _6m_reply 'button 8 if PinB.7 =1 then gosub _kp10iu 'button 0 low B.0:low B.1:high B.2 'read left hand row if PinB.4 =1 then gosub _oh1tv 'button 1 if PinB.5 =1 then gosub _cq_tv 'button 4 if PinB.6 =1 then gosub _r599tu 'button 7 if PinB.7 =1 then gosub _op 'button * if PinC.6 = 0 then gosub _dah 'start dah goto Start 'LEVEL 4 -------------------------------------------------------------------- _cq_tv: 'CQ CQ DE OH1TV OH1TV K for b3=0 to 5 'number of marks in the message lookup b3,(0,0,1,2,2,3),Mark on Mark gosub _cq,_de,_oh1tv,_k 'goto lower level routines next return _cq_o: 'CQ CQ DE OH1O OH1O K for b3=0 to 5 lookup b3,(0,0,1,2,2,3),Mark on Mark gosub _cq,_de,_oh1o,_k next return _cq_wx: 'CQ CQ DE OH1WX OH1WX K for b3=0 to 5 lookup b3,(0,0,1,2,2,3),Mark on Mark gosub _cq,_de,_oh1wx,_k next return 'LEVEL 3 --------------------------------------------------------------------- _oh1tv: 'OH1TV+ws 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 return _oh1o: 'OH1O+ws 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 _op: 'OP PEKKA PEKKA =+ws for b4=0 to 16 lookup b4,(3,3,3,0,1,3,3,1,2,4,4,3,1,1,1,3,2),Mark on Mark gosub _chs,_dit,_ws,_dah,_pekka next return _qth: 'QTH NR TURKU TURKU =+ws for b4=0 to 26 lookup b4,(3,3,1,3,0,3,0,1,1,1,1,2,3,1,0,1,3,1,2,4,4,3,1,1,1,3,2),Mark on Mark gosub _chs,_dit,_ws,_dah,_turku next return _r599tu: 'R 5NN TU for b4=0 to 9 lookup b4,(1,3,1,2,4,3,0,1,1,3),Mark on Mark gosub _chs,_dit,_ws,_dah,_5nn next return _6m_reply: 'R 5NN 5NN KP10iu KP10iu bk for b4=0 to 8 lookup b4,(1,3,1,2,4,4,5,5,6),Mark on Mark gosub _chs,_dit,_ws,_dah,_5nn,_kp10iu,_bk next return 'LEVEL 2 ---------------------------------------------------------------------- _oh1: 'OH1+chs 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 'goto level 1 routines next return _cq: 'CQ+ws for b5=0 to 9 lookup b5,(3,1,3,1,0,3,3,1,3,2),Mark on Mark gosub _chs,_dit,_ws,_dah next return _de: 'DE+ws for b5=0 to 5 lookup b5,(3,1,1,0,1,2),Mark on Mark gosub _chs,_dit,_ws,_dah next return _bk: 'BK for b5=0 to 7 lookup b5,(3,1,1,1,0,3,1,3),Mark on Mark gosub _chs,_dit,_ws,_dah next return _k: 'K+chs for b5=0 to 2 lookup b5,(3,1,3),Mark on Mark gosub _chs,_dit,_ws,_dah next return _pekka: 'PEKKA+ws for b5=0 to 17 lookup b5,(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 _turku: 'TURKU+ws for b5=0 to 17 lookup b5,(3,0,1,1,3,0,1,3,1,0,3,1,3,0,1,1,3,2),Mark on Mark gosub _chs,_dit,_ws,_dah next return _5nn: '5NN+ws for b5=0 to 11 lookup b5,(1,1,1,1,1,0,3,1,0,3,1,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 _qrz: 'QRZ? for b5=0 to 19 lookup b5,(3,3,1,3,0,1,3,1,0,3,3,1,1,0,1,1,3,3,1,1),Mark on Mark gosub _chs,_dit,_ws,_dah next return 'LEVEL 1 ---------------------------------------------------------------------- _chs: '0 make space between characters for w9=0 to w7 pulsout C.2,400 'imitate pause, pin not used next return _dit: '1 make Dit and sidetone high C.1 'dit starts for w9=0 to w5 'dit length pulsout C.0,400 'sidetone cycle length next low C.1 'dit ends for w9=0 to w10 'make space between marks pulsout C.2,350 'imitate pause, pin not used next return _ws: '2 make space between words for w9=0 to w8 pulsout C.2,400 'imitate pause, pin not used next return _dah: '3 make Dah and sidetone high C.1 'dah starts for w9=0 to w6 'dah length pulsout C.0,400 'sidetone cycle length next low C.1 'dah ends for w9=0 to w10 'make space between marks pulsout C.2,350 'imitate pause, pin not used next return '----------------------------------------------------------------------------- Interrupt: 'stop the message by setting b3=30 'lookup offset above max, level 4 b4=30 'lookup offset above max, level 3 b5=30 'lookup offset above max, level 2 w9=1000 'pulsout counter above max, level 1 setint %00000000,%00001000 'reactivate interruption with C.3, return '----------------------------------------------------------------------------- 'end