Rem ********************************************************************** Rem * PICAXE Multi Mode Keyer by VK6HV * Rem * (it's crude but it works) * Rem * It just fits..... 246 of 256 bytes!!! * REM * * Rem * The modes are: * Rem * Iambic Mode A, Bug Mode and a Random Code Generator * Rem * * Rem * * Rem * (Thanks again Stan!) * Rem ********************************************************************** REM 29 - 07 - 2008 Made a few changes. REM 2 - 08 - 2008 Uploaded to web site. REM 1 - 08 - 2010 Two bugs found by VE3STI! REM 3 - 08 - 2010 Uploaded a newer version, hopefully a bit better. REM NOTE: When powering up, holding only the Dit paddle *ON* forces the keyer into "Bug Mode" REM When powering up, holding only the Dah paddle *ON* forces the keyer into "Iambic Mode A" REM When powering up, holding both paddles *ON* forces the keyer to genenrate randon morse code" Begin: Symbol Tone = b0 Symbol Quiet = 0 Symbol DitLength = b1 Symbol DitSpace = b2 Symbol DahLength = b3 Symbol DahSpace = b4 Symbol Character = b5 Symbol Index = b7 Symbol Elements = b8 Symbol WordLength = b3 Symbol RandomNumber = W5 Symbol MemLocation = b12 EEPROM 1, (1,2,3,4,5,13,20,29,35,36,54,61,66,67,68,86,99,100,116,125,129,130,131,132,133,134,141,148,149,163,164,180,182,194,195,196,197,206,212,227,229,245,253) PAUSE 1500 PickMode: IF Pin1 = 0 And Pin2 = 0 Then Goto RandomCode IF Pin1 = 0 then Goto IambicMode_A IF Pin2 = 0 then Goto IambicBugMode Goto PickMode START: ReadADC 0, b0 b0 = b0 / 3 + 40 readADC 4, b1 b1 = b1 / 50 + 4 b2 = b1 b3 = b1 * 3 b4 = b2 If b9 = 0 Then Goto IambicMode_A If b9 = 1 Then Goto IambicBugMode If b9 = 2 Then Goto RandomCode REM IAMBIC KEYER MODE "A" IambicMode_A: b9 = 0 CheckForMode_ADit: If Pin2 = 0 then Mode_ADit CheckForMode_ADah: If Pin1 = 0 then Mode_ADah Goto START REM Mode_A Mode_ADit: High 1 Sound 5, (Tone, DitLength) Low 1 Sound 5, (Quiet, DitSpace) Goto CheckForMode_ADah Mode_ADah: High 1 Sound 5, (Tone, DahLength) Low 1 Sound 5, (Quiet, DahSpace) Goto CheckForMode_ADit REM IAMBIC KEYER "BUG" MODE IambicBugMode: b9 = 1 CheckForDitAndDah: If Pin2 = 0 And Pin1 = 0 then IambicBugMode CheckForDit: If Pin2 = 0 then BugModeDit CheckForDah: If Pin1 = 0 then BugModeDah Goto START REM BugMode BugModeDit: High 1 Sound 5, (Tone, DitLength) Low 1 Sound 5, (Quiet, DitSpace) Goto START REM BugMode BugModeDah: High 1 Sound 5, (Tone, DahLength) Low 1 Sound 5, (Quiet, DahSpace) Goto START REM BugMode REM RANDOM CODE GENERATOR RandomCode: b9 = 2 Random RandomNumber 'puts a random number into RandomNumber (word W5) MemLocation = RandomNumber // 43 + 1 'using the modulus divide, this should give a number between 1 and 43 which should correspond to an EEprom memory 'location between 1 and 43 and puts it into byte MemLocation(b12) Read MemLocation, Character 'this goes to EEprom memory location 1-43 and "reads" the value in that location and puts it into "Character"(b5) 'the value put into "Character"(b5) is the Morse encoded character Gosub Morse Goto Start Morse: Let Elements = Character & %00000111 'this extracts how many Elements are in the Morse character by ANDing, masking out the bits 5, 6, 7 & 8 in If Elements = 0 then Word_Sp '"Character"(b5) leaving only the number of Elements in the Morse character. This values is in "Elements"(b8) Bang_Key: For index = 1 to Elements If Character >= 128 then Random_Dah 'the program needs a place to start the Morse, so if the value in "Character(b5) is >= 128, start with a DAH, Goto Random_Dit 'if it's less then 128, then start with a DIT Reenter: Let Character = Character * 2 'shift left Next Gosub Char_Sp Return Random_Dit: High 1 Sound 5,(Tone,DitLength) Low 1 Sound 5, (Quiet,DitLength) Goto Reenter Random_Dah: High 1 Sound 5,(Tone,DahLength) Low 1 Sound 5,(Quiet,DitLength) Goto Reenter Char_Sp: Sound 5,(Quiet,DahLength) Return Word_Sp: Sound 5,(Quiet,WordLength) Return REM FOR THOSE WHO DON'T KNOW MORSE CODE:) REM A .- B -... C -.-. D -.. E . F ..-. REM G --. H .... I .. J .--- K -.- L .-.. REM M -- N -. O --- P .--. Q --.- R .-. REM S ... T - U ..- V ...- W .-- X -..- REM Y -.-- Z --.. REM 1 .---- 2 ..--- 3 ...-- 4 ....- 5 ..... REM 6 -.... 7 --... 8 ---.. 9 ----. 0 ----- REM SOME PUNCTUATION THAT WILL WORK WITH THIS REPEATER CONTROLLER REM FULL STOP .-.-.- COMMA --..-- FWD SLASH -..-. REM EQUAL -...- HYPHEN -....- BRACKETS -.--.- REM UNDERSCORE ..--.- REM NUMBERS USED TO PROGRAM YOUR MESSAGE IN THE "CONTROLLER" REM LETTERS: REM A 66, B 132, C 164, D 131, E 1, F 36, REM G 195, H 4, I 2, J 116, K 163, L 68, REM M 194, N 130, O 227, P 100, Q 212, R 67, REM S 3, T 129, U 35, V 20, W 99, X 148, REM Y 180, Z 196, REM NUMBERS: REM 1 125, 2 61, 3 29, 4 13, 5 5, REM 6 133, 7 197, 8 229, 9 245, 0 253, REM SOME PUNCTUATION THAT WILL WORK WITH THIS REPEATER CONTROLLER REM FULL STOP 86, COMMA 206, FWD SLASH 149, REM EQUAL 141, HYPHEN 134, BRACKETS 182, REM UNDERSCORE 54,