'######################################################################### '# '# ***** * *** ***** * * **** '# * * * * * * * * '# * * * * * * * * * * '# ***** * * * * * * ***** '# * * * * * * * * * * '# * * * * * * * * '# ***** ***** *** * * * ***** '# '# '# *** MEMORY SLOT #2 *** *** MEMORY SLOT #2 *** '# '# 73's Steve - VK6HV '######################################################################### #Slot 2 #No_Data SetFreq M16 Rem ********************************************************************** Rem * The PICAXE 28X2 Electronic Keyer * Rem * Pin configuration, Notes etc. etc. * Rem * * Rem * PIN# Project Use PICAXE Pin Definition * Rem * * Rem * Pin #1 Reset [Reset] * Rem * Pin #2 DC Supply Voltage [Digital In/Out, Analog In A.0] * Rem * Pin #3 12 Position Switch [Digital In/Out, Analog In A.1] * Rem * Pin #4 CW Tone [Digital In/Out, Analog In A.2] * Rem * Pin #5 CW Speed [Digital In/Out, Analog In A.3] * Rem * Pin #6 Serial In(Program) [Serial In] * Rem * Pin #7 Serial Out(Program) [Digital In/Out, A.4 Serial Out] * Rem * Pin #8 0 Volts [0 Volts] * Rem * Pin #9 Resonator [Resonator (not used)] * Rem * Pin #10 Resonator [Resonator (not used)] * Rem * Pin #11 DAH paddle [Digital In/Out, C.0] * Rem * Pin #12 DIT paddle [Digital In/Out, C.1] * Rem * Pin #13 LED [Digital In/Out, Analog In C.2] * Rem * Pin #14 4 Position Switch [Digital In/Out, Analog In C.3] * Rem * Pin #15 Relay Output [Digital In/Out, Analog In C.4] * Rem * Pin #16 Speaker Out [Digital In/Out, Analog In C.5] * Rem * Pin #17 LCD RS [Digital In/Out, Analog In C.6] * Rem * Pin #18 LCD E [Digital In/Out, Analog In C.7] * Rem * Pin #19 0 Volts [0 Volts] * Rem * Pin #20 5 Volts [+5 Volts] * Rem * Pin #21 LCD Data Bit 0 [Digital In/Out, Analog In B.0] * Rem * Pin #22 LCD Data Bit 1 [Digital In/Out, Analog In B.1] * Rem * Pin #23 LCD Data Bit 2 [Digital In/Out, Analog In B.2] * Rem * Pin #24 LCD Data Bit 3 [Digital In/Out, Analog In B.3] * Rem * Pin #25 LCD Data Bit 4 [Digital In/Out, Analog In B.4] * Rem * Pin #26 LCD Data Bit 5 [Digital In/Out, Analog In B.5] * Rem * Pin #27 LCD Data Bit 6 [Digital In/Out, B.6] * Rem * Pin #28 LCD Data Bit 7 [Digital In/Out, B.7] * Rem * * Rem ********************************************************************** Rem ********************************************************************** Rem * The PICAXE 28X2 Electronic Keyer * Rem * ---> Words & Bytes used in Slot#2 <--- * Rem * * Rem * W0 = used for Morse Code routine, speaker output frequency calc * Rem * b0 = used for Morse Code routine, speaker output frequency * Rem * b1 = * Rem * * Rem * W1 = used for Morse Code dot length calc * Rem * b2 = used for Morse Code routine, dot length * Rem * b3 = * Rem * * Rem * W2 = * Rem * b4 = used for Morse Code routine, dash length * Rem * b5 = used for Morse Code routine, character space * Rem * * Rem * W3 = used for Morse Code routine, word space * Rem * b6 = * Rem * b7 = * Rem * * Rem * W4 = * Rem * W5 = * Rem * * Rem * W6 = * Rem * b12 = used for the encoded character in the Morse routine * Rem * b13 = used in the Morse routine, modulus divide math byte * Rem * * Rem * W7 = used to generate random words and radio words * Rem * b14 = * Rem * b15 = * Rem * * Rem * W8 = used to generate random words and radio words * Rem * b16 = * Rem * b17 = * Rem * * Rem * W9 = used to generate random words and radio words * Rem * b18 = * Rem * b19 = * Rem * * Rem * W10 = used to generate random words and radio words * Rem * b20 = * Rem * b21 = * Rem * * Rem * W11 = used to generate random words and radio words * Rem * b22 = * Rem * b23 = * Rem * * Rem * W12 = used to generate random words and radio words * Rem * b24 = * Rem * b25 = * Rem * * Rem * W13 = used to generate random words and radio words * Rem * b26 = * Rem * b27 = * Rem * * Rem * W14 = used to generate random words and radio words * Rem * b28 = * Rem * b29 = * Rem * * Rem * W15 = * Rem * W16 = * Rem * W17 = * Rem * W18 = * Rem * W19 = * Rem * W20 = * Rem * W21 = * Rem * W22 = used to clear the scratch pad * Rem * W23 = used to clear some Words and Bytes * Rem * * Rem * W24 = * Rem * b48 = * Rem * b49 = used to bypass the reloading of the scratchpad in slot#2 * Rem * * Rem * W25 = * Rem * b50 = used in For/Next to push characters/instructions to the LCD * Rem * b51 = used in For/Next to push characters/instructions to the LCD * Rem * * Rem * W26 = * Rem * b52 = used for calculating the 4 pole switch position * Rem * b53 = used for calculating the 4 pole switch position * Rem * * Rem * W27 = * Rem * b54 = used for calculating the 12 pole switch position * Rem * b55 = used for calculating the 12 pole switch position * Rem * * Rem ********************************************************************** '######################################################################### '# SkipScratchpad: '# This stops the scratchpad from being loaded everytime there is a return '# to slot#2. '# '######################################################################### PreStart: If b49 = 1 Then Goto SkipScratchpad b49 = 1 '######################################################################### '# MOST COMMON ENGLISH WORDS '# (sorry only 5 letter long words) '# '######################################################################### 'SCRATCHPAD RANKING 'MEMORY ENCODED PER 1000 'ADDRESS CHARACTERS + 0 WORD WORDS '******************************************************************* Put 6,6,5,29,0 'any 100 Put 12,13,5,15,14,0 'know 98 Put 18,14,16,2,10,2,0 'where 96 Put 24,21,6,18,18,0 'call 94 Put 30,6,20,3,2,10,0 'after 92 Put 36,18,15,5,11,0 'long 90 Put 42,7,6,29,0 'may 88 Put 48,20,4,5,9,0 'find 86 Put 54,15,5,18,29,0 'only 84 Put 60,9,4,9,0 'did 82 Put 66,7,6,9,2,0 'made 80 Put 72,5,15,14,0 'now 78 Put 78,4,3,8,0 'its 76 Put 84,20,4,10,8,3,0 'first 74 Put 90,7,6,13,2,0 'make 72 Put 96,21,15,12,18,9,0 'could 70 Put 102,8,2,2,0 'see 68 Put 108,18,4,13,2,0 'like 66 Put 114,16,2,10,0 'her 64 Put 120,16,6,8,0 'has 62 Put 126,15,3,16,2,10,0 'other 60 Put 132,3,16,2,8,2,0 'these 58 Put 138,8,15,7,2,0 'some 56 Put 144,8,16,2,0 'she 54 Put 150,3,16,2,7,0 'them 52 Put 156,12,22,0 'up 50 Put 162,6,17,15,12,3,0 'about 48 Put 168,14,4,18,18,0 'will 46 Put 174,4,20,0 'if 44 Put 180,3,16,2,4,10,0 'their 42 Put 186,29,15,12,10,0 'your 40 Put 192,21,6,5,0 'can 38 Put 198,14,2,0 'we 36 Put 204,14,2,10,2,0 'were 34 Put 210,14,16,6,3,0 'what 32 Put 216,5,15,3,0 'not 30 Put 222,15,5,2,0 'one 28 Put 228,15,10,0 'or 26 Put 234,4,0 'I 24 Put 240,3,16,4,8,0 'this 22 Put 246,6,3,0 'at 20 Put 252,16,4,8,0 'his 18 Put 258,6,8,0 'as 16 Put 264,15,5,0 'on 14 Put 270,20,15,10,0 'for 12 Put 276,4,3,0 'it 10 Put 282,29,15,12,0 'you 8 Put 288,4,5,0 'in 6 Put 294,6,0 'a 4 Put 300,15,20'0 'of 2 Put 306,3,16,2'0 'the 1 ;-) Put 312,6,5,9,0 'and 3 Put 318,3,15,0 'to 5 Put 324,4,8,0 'is 7 Put 330,3,16,6,3,0 'that 9 Put 336,16,2,0 'he 11 Put 342,14,6,8,0 'was 13 Put 348,6,10,2,0 'are 15 Put 354,14,4,3,16,0 'with 17 Put 360,3,16,2,29,0 'they 19 Put 366,17,2,0 'be 21 Put 372,20,10,15,7,0 'from 23 Put 378,16,6,24,2,0 'have 25 Put 384,17,29,0 'by 27 Put 390,16,6,9,0 'had 29 Put 396,17,12,3,0 'but 31 Put 402,6,18,18,0 'all 33 Put 408,14,16,2,5,0 'when 35 Put 414,3,16,2,10,2,0 'there 37 Put 420,6,5,0 'an 39 Put 426,14,16,4,21,16,0 'which 41 Put 432,8,6,4,9,0 'said 43 Put 438,9,15,0 'do 45 Put 444,2,6,21,16,0 'each 47 Put 450,16,15,14,0 'how 49 Put 456,15,12,3 'out 51 Put 462,3,16,2,5,0 'then 53 Put 468,16,2,10,2,0 'here 55 Put 474,8,15,0 'so 57 Put 480,14,15,12,18,9,0 'would 59 Put 486,4,5,3,15,0 'into 61 Put 492,7,15,10,2,0 'more 63 Put 498,3,14,15,0 'two 65 Put 504,16,4,7,0 'him 67 Put 510,3,4,7,2,0 'time 69 Put 516,5,15,0 'no 71 Put 522,3,16,6,5,0 'than 73 Put 528,17,2,2,5,0 'been 75 Put 534,14,16,15,0 'who 77 Put 540,7,29,0 'my 79 Put 546,15,24,2,10,0 'over 81 Put 552,9,15,14,5,0 'down 83 Put 558,14,6,29,0 'way 85 Put 564,12,8,2,0 'use 87 Put 570,7,6,5,29,0 'many 89 Put 576,24,2,10,29,0 'very 91 Put 582,14,15,10,9,8,0 'words 93 Put 588,30,12,8,3,0 'just 95 Put 594,7,15,8,3,0 'most 97 Put 600,11,2,3,0 'get 99 REM *** ENCODED HARACTER NUMBERS *** REM A 6, B 17, C 21, D 9, E 2, F 20, REM G 11, H 16, I 4, J 30, K 13, L 18, REM M 7, N 5, O 15, P 22, Q 27, R 10, REM S 8, T 3, U 12, V 24, W 14, X 25, REM Y 29, Z 19, '######################################################################### '# MOST COMMON CW RADIO WORDS '# (sorry only 5 letter long words) '# '######################################################################### 'SCRATCHPAD ENCODED 'MEMORY CHARACTER 'ADDRESS PLUS A "0" WORD MEANING '************************************************************************* Put 610,27,10,18,0 'QRL - This frequency is busy Put 615,27,10,7,0 'QRM - I have interference Put 620,27,10,5,0 'QRN - I have static Put 625,27,10,8,0 'QRS - Please send slower Put 630,27,10,3,0 'QRT - I must go now Put 635,27,10,19,0 'QRZ - Who is calling me? Put 640,27,8,18,0 'QSL - I understand Put 645,27,8,15,0 'QSO - A radio contact Put 650,27,8,29,0 'QSY - Change frequency Put 655,27,3,16,0 'QTH - My location is... Put 660,27,10,25,0 'QRX - Please stand by Put 665,6,17,3,0 'ABT - About Put 670,6,11,2,0 'AGE - My age, your age Put 675,6,5,3,0 'ANT - Antenna Put 680,17,2,6,7,0 'BEAM - Beam antenna Put 685,17,13,0 'BK - Break in (it's your turn) Put 690,17,3,0 'BT - Break, like "Ahhhh" in English Put 695,17,3,12,0 'BTU - Back to you, or "over to you" Put 700,21,0 'C - Yes Put 705,21,18,0 'CL - I am closing, leaving, got to go. Put 710,21,18,76,0 'CL? - What your call sign? Put 715,21,14,0 'CW - Morse Put 720,21,22,29,0 'CPY - Copy? Do you copy? Put 725,21,27,0 'CQ - General call Put 730,21,12,18,0 'CUL - See you later Put 735,9,2,0 'DE - From Put 740,9,25,0 'DX - Long distance Put 745,2,18,0 'EL - Element(s) Put 750,20,17,0 'FB - Fine business, all OK, everything is OK Put 755,16,4,0 'HI - Joke, I am kidding Put 760,16,14,0 'HW - How or "How do you copy"? Put 765,16,10,0 'HR - Here Put 770,13,0 'K - I am finished, you rturn to xmit Put 775,5,6,7,2,0 'NAME - My radio name is... Put 780,15,7,0 'OM - Old man, CW operator or good CW operator Put 785,15,22,0 'OP - CW Operator, used instead of name Put 790,22,8,2,0 'PSE - Please Put 795,10,10,0 'RR - I have copied all Put 800,10,22,3,0 'RPT - Pleae repeat Put 805,10,8,3,0 'RST - Signal report Put 810,10,4,11,0 'RIG - My equipment Put 815,3,2,7,22,0 'TEMP - Temperature (outside temp) Put 820,3,2,8,3,0 'TEST - Contest, or "CQ TEST" Put 825,3,12,0 'TU - Thanks (most popular) Put 830,3,13,8,0 'TKS - Thanks Put 835,3,5,25,0 'TNX - Thanks Put 840,24,2,10,3,0 'VERT - Vertical antenna Put 845,14,6,3,3,0 'WATT - Power output Put 850,14,25,0 'WX - Current weather Put 855,29,6,11,4,0 'YAGI - Yagi beam na Put 860,29,10,8,0 'YRS - Years as in age Put 865,35,56,0 '73 - Best regards, good bye Put 870,39,39,0 '88 - Love and kisses (for the ladies) Put 875,32,5,5,0 '5NN - Typical signal report, RST = 599 'Put 880,0 'Put 885,0 'Put 890,0 'Put 895,0 'Put 900,0 'Put 905,0 'Put 910,0 'Put 920,0 'Put 925,0 'Put 930,0 'Put 935,0 REM *** ENCODED CHARACTER NUMBERS *** REM A 6, B 17, C 21, D 9, E 2, F 20, REM G 11, H 16, I 4, J 30, K 13, L 18, REM M 7, N 5, O 15, P 22, Q 27, R 10, REM S 8, T 3, U 12, V 24, W 14, X 25, REM Y 29, Z 19, '######################################################################### '# Start: '# '# This is the "START" position. '# RandomNormDistWords = 100 common English words,(normal distribution) '# RandomEvenDistWords = 100 common English words, (even distribution) '# ConsecutiveWords = 100 common English words (consecutively) '# ConsecutiveRadioWords = 58 radio words (consecutively) '# RandomRadioWords = 58 randon words (random) '# '######################################################################### Start: Let dirsB = %11111111 Gosub ClearSomeWordsAndBytes SkipScratchpad: MainDirectory: Gosub Check4PoleSwitch Gosub Check12PoleSwitch Select Case b55 Case 1 Goto Menu1 'RandomNormDistWords Case 2 Goto Menu2 'RandomEvenDistWords Case 3 Goto Menu3 'ConsecutiveWords Case 4 Goto Menu4 'ConsecutiveRadioWords Case 5 Goto Menu5 'RandomRadioWords Case 6 Goto Menu6 'Spare Menu 6 Case 7 Goto Menu7 'Spare Menu 7 Case 8 Goto Menu8 'Spare Menu 8 Case 9 Goto Menu9 'Spare Menu 9 Case 10 Goto Menu10 'Spare Menu 10 Case 11 Goto Menu11 'Spare Menu 11 Case 12 Goto Menu12 'Spare Menu 12 End Select '######################################################################### '# RandomNormDistWords: '# MOST COMMON ENGLISH WORDS (random) '# '# This sends the 100 most commom English words over and over and over. '# The #1 word "the" will be sent more times than the 100th '# word "any". I don't think it's really a normal distribution but more '# like a triagle wave then a sine wave. '# '######################################################################### Menu1: Gosub ClearLCDScreen For b50 = 0 to 15 Lookup b50, ("100 COMMON WORDS"), b51 Gosub WriteCharacter Next b50 Gosub MoveCursorToSecondLine For b50 = 0 to 13 Lookup b50,(" NORMAL DIST"), b51 Gosub WriteCharacter Next b50 SubMenu1: RandomNormDistWords: Gosub ReadTonePotentiometer Gosub ReadSpeedPotentiometer Random W7 w8 = w7 // 51 + 1 w9 = w8 * 6 Random W10 W11 = w10 // 50 w12 = w11 * 6 w13 = w9 + w12 For w14 = 0 to 5 w15 = w13 + w14 Get w15, b12 Gosub Check4PoleSwitch Gosub Check12PoleSwitch If b55 <> 1 Then Goto MainDirectory Gosub Morse If b12 = 0 Then Goto RandomNormDistWords Next Goto RandomNormDistWords '######################################################################### '# RandomEvenDistWords: '# MOST COMMON ENGLISH WORDS (random "even" distribution) '# '# This randomly sends the 100 most commom English words over and over and '# over. The #1 word "the" should be sent the same amount of times as the '# 100th word "any". '# '######################################################################### Menu2: Gosub ClearLCDScreen For b50 = 0 to 15 Lookup b50, ("100 COMMON WORDS"), b51 Gosub WriteCharacter Next b50 Gosub MoveCursorToSecondLine For b50 = 0 to 12 Lookup b50,(" EVEN DIST"), b51 Gosub WriteCharacter Next b50 SubMenu2: RandomEvenDistWords: Gosub ReadTonePotentiometer Gosub ReadSpeedPotentiometer Random w7 w8 = w7 // 101 + 1 w9 = w8 * 6 For w10 = 0 to 5 w11 = w9 + w10 Get w11, b12 Gosub Check4PoleSwitch Gosub Check12PoleSwitch If b55 <> 2 Then Goto MainDirectory Gosub Morse If b12 = 0 Then goto RandomEvenDistWords Next Goto RandomEvenDistWords '######################################################################### '# ConsecutiveWords: '# MOST COMMON ENGLISH WORDS (consecutive) '# '# This sends the 100 most commom english words over and over and over in '# consecutive order 1 - 100. '# '######################################################################### Menu3: Gosub ClearLCDScreen For b50 = 0 to 15 Lookup b50, ("100 COMMON WORDS"), b51 Gosub WriteCharacter Next b50 Gosub MoveCursorToSecondLine For b50 = 0 to 12 Lookup b50,(" CONSECUTIVE"), b51 Gosub WriteCharacter Next b50 SubMenu3: ConsecutiveWords: For w7 = 0 to 600 step 6 For w8 = 0 to 5 w9 = w7 + w8 Get w9, b12 Gosub ReadTonePotentiometer Gosub ReadSpeedPotentiometer Gosub Check4PoleSwitch Gosub Check12PoleSwitch If b55 <> 3 Then Goto MainDirectory Gosub Morse If b12 = 0 then goto StartAnotherConLetter Next StartAnotherConLetter: Next Goto ConsecutiveWords '######################################################################### '# ConsecutiveRadioWords: '# MOST COMMON CW RADIO WORDS '# '# This sends the 58 commom abbreviated CW words in consecutive order over '# and over and over. Example, OM, XYL, QTH, FB, Sigs, 5NN etc. etc. '# '######################################################################### Menu4: Gosub ClearLCDScreen For b50 = 0 to 14 Lookup b50, (" 58 CONSECUTIVE"), b51 Gosub WriteCharacter Next b50 Gosub MoveCursorToSecondLine For b50 = 0 to 11 Lookup b50,(" CW WORDS"), b51 Gosub WriteCharacter Next b50 SubMenu4: ConsecutiveRadioWords: For w7 = 610 to 875 step 5 For w8 = 0 to 5 w9 = w7 + w8 Get w9, b12 Gosub ReadTonePotentiometer Gosub ReadSpeedPotentiometer Gosub Check4PoleSwitch Gosub Check12PoleSwitch If b55 <> 4 Then Goto MainDirectory Gosub Morse If b12 = 0 then goto StartAnotherRadioLetter Next StartAnotherRadioLetter: Next Goto ConsecutiveRadioWords '######################################################################### '# RandomRadioWords: '# MOST COMMON CW RADIO WORDS '# '# This randomly sends 58 commom abbreviated CW words in consecutive order '# over and over and over. Example, OM, XYL, QTH, RB, Sigs, 5NN etc. etc. '# '######################################################################### Menu5: Gosub ClearLCDScreen For b50 = 0 to 12 Lookup b50, (" 55 RANDOM"), b51 Gosub WriteCharacter Next b50 Gosub MoveCursorToSecondLine For b50 = 0 to 11 Lookup b50,(" CW WORDS"), b51 Gosub WriteCharacter Next b50 SubMenu5: RandomRadioWords: Gosub ReadTonePotentiometer Gosub ReadSpeedPotentiometer Random w7 w8 = w7 // 54 + 122 '58 was 62. Ha, now 54 w9 = w8 * 5 For w10 = 0 to 5 w11 = w9 + w10 Get w11, b12 Gosub Check4PoleSwitch Gosub Check12PoleSwitch If b55 <> 5 Then Goto MainDirectory Gosub Morse If b12 = 0 Then goto RandomRadioWords Next Goto RandomRadioWords '######################################################################### '# '# *** THESE ARE SPARE MENUS *** *** THESE ARE SPARE MENUS *** '# '######################################################################### Menu6: Gosub ClearLCDScreen For b50 = 0 to 12 Lookup b50, (" SPARE MENU"), b51 Gosub WriteCharacter Next b50 SubMenu6: Gosub Check4PoleSwitch Gosub Check12PoleSwitch If b55 <> 6 then Goto MainDirectory Goto SubMenu6 '######################################################################### '# '# *** THESE ARE SPARE MENUS *** *** THESE ARE SPARE MENUS *** '# '######################################################################### Menu7: Gosub ClearLCDScreen For b50 = 0 to 12 Lookup b50, (" SPARE MENU"), b51 Gosub WriteCharacter Next b50 SubMenu7: Gosub Check4PoleSwitch Gosub Check12PoleSwitch If b55 <> 7 then Goto MainDirectory Goto SubMenu7 '######################################################################### '# '# *** THESE ARE SPARE MENUS *** *** THESE ARE SPARE MENUS *** '# '######################################################################### Menu8: Gosub ClearLCDScreen For b50 = 0 to 12 Lookup b50, (" SPARE MENU"), b51 Gosub WriteCharacter Next b50 SubMenu8: Gosub Check4PoleSwitch Gosub Check12PoleSwitch If b55 <> 8 then Goto MainDirectory Goto SubMenu8 '######################################################################### '# '# *** THESE ARE SPARE MENUS *** *** THESE ARE SPARE MENUS *** '# '######################################################################### Menu9: Gosub ClearLCDScreen For b50 = 0 to 12 Lookup b50, (" SPARE MENU"), b51 Gosub WriteCharacter Next b50 SubMenu9: Gosub Check4PoleSwitch Gosub Check12PoleSwitch If b55 <> 9 then Goto MainDirectory Goto SubMenu9 '######################################################################### '# '# *** THESE ARE SPARE MENUS *** *** THESE ARE SPARE MENUS *** '# '######################################################################### Menu10: Gosub ClearLCDScreen For b50 = 0 to 12 Lookup b50, (" SPARE MENU"), b51 Gosub WriteCharacter Next b50 SubMenu10: Gosub Check4PoleSwitch Gosub Check12PoleSwitch If b55 <> 10 then Goto MainDirectory Goto SubMenu10 '######################################################################### '# '# *** THESE ARE SPARE MENUS *** *** THESE ARE SPARE MENUS *** '# '######################################################################### Menu11: Gosub ClearLCDScreen For b50 = 0 to 12 Lookup b50, (" SPARE MENU"), b51 Gosub WriteCharacter Next b50 SubMenu11: Gosub Check4PoleSwitch Gosub Check12PoleSwitch If b55 <> 11 then Goto MainDirectory Goto SubMenu11 '######################################################################### '# '# *** THESE ARE SPARE MENUS *** *** THESE ARE SPARE MENUS *** '# '######################################################################### Menu12: Gosub ClearLCDScreen For b50 = 0 to 12 Lookup b50, (" SPARE MENU"), b51 Gosub WriteCharacter Next b50 SubMenu12: Gosub Check4PoleSwitch Gosub Check12PoleSwitch If b55 <> 12 then Goto MainDirectory Goto SubMenu12 '######################################################################### '######################################################################### '# '# *** THESE ARE THE SUB-ROUTINES *** *** THESE ARE THE SUB-ROUTINES *** '# '######################################################################### '######################################################################### '######################################################################### '# Check4PoleSwitch: '# This checks the 0 - 5 VDC analog value of the 4 resistors and then '# calculates a whole number value from 0 to 3. The code then does a '# "Select Case" to determine which memory slot# to "Goto". This happens if '# the 4 pole switch has been turned to a different position. '# NOTE:"Run" is basically a "Goto". You can't "Gosub" to anothr slot. '# '######################################################################### Check4PoleSwitch: ReadADC C.3, b52 b53 = b52 - 32 / 63 Select Case b53 Case 0 Run 0 'goes to memory slot #0 Case 1 Run 1 'goes to memory slot #1 Case 2 Return Case 3 Run 3 'goes to memory slot #3 End Select Return '######################################################################### '# Check12PoleSwitch: '# This checks the 0 - 5 VDC analog value of the 12 resistors and then '# calculates a whole number value from 1 to 12. Eventually the code goes '# back to the "Main Directory" and the Select Case determines which menu '# to "Goto". This happens if the 12 pole switch has been turned to a '# different position. '# '######################################################################### Check12PoleSwitch: ReadADC A.1, b54 b55 = b54 - 12 / 21 + 1 Return '######################################################################### '# ReadTonePotentiometer: '# This is the Read Tone Potentiometer Sub-Routine. It scales a number '# from 5 to 115, (W0) from the Tone Potentiometer. '# '######################################################################### ReadTonePotentiometer: ReadADC A.2, b0 w0 = b0 * 115 / 255 + 5 Return '######################################################################### '# ReadSpeedPotentiometer: '# This is the Read Speed Potentiometer Sub-Routine. It scales a number '# from 6 to 85, (W1) from the Speed Potentiometer. Fastest dots are about '# 30mS. and slowest dots are about 210mS. '# B2 = Dit length '# B4 = Dah length = Dit length x 3 '# B5 = Character Space = Dit length x 3 '# W3 = Word Space = b2 x 7 (the delay after 5 random characters) '# '# Below, change *7 to *8 or *9 or maybe *10 .... if you would like a bit '# more time between call signs. '# '######################################################################### ReadSpeedPotentiometer: ReadADC A.3, b2 w1 = b2 * 79 / 255 + 6 'dit length b4 = b2 * 3 'dah length b5 = b2 * 3 'character space w3 = b2 * 7 'word space Return '######################################################################### '# ClearScratchpad: '# This clears out all numbers in the scratchpad by inserting a "0" zero '# in each location '# '######################################################################### ClearScratchpad: For w22 = 0 to 1023 Put w22, 0 Next Return '######################################################################### '# ClearSomeWordsAndBytes: '# This clears Words W0 - W18 or Bytes B0 - B37 and sets them all to 0. '# '######################################################################### ClearSomeWordsAndBytes: For w23 = 0 to 18 Poke w23, 0 Next w23 = 0 Return '######################################################################### '# Morse: '# This is the Morse Code Routine. '# '######################################################################### Morse: If b12 = 0 then Goto WordSpace Do b13 = b12 // 2 'returns remainder, odd or even (dit or dah) b12 = b12 / 2 'shift right If b13 = 0 then Gosub dit If b13 = 1 then Gosub Dah Loop until b12 = 1 Gosub CharacterSpace Return Dit: High C.4 High C.2 Sound C.5, (b0,b2) Low C.4 Low C.2 Sound C.5, (0,b2) Return Dah: High C.4 High C.2 Sound C.5, (b0,b4) Low C.4 Low C.2 Sound C.5, (0,b2) Return CharacterSpace: Sound C.5, (0,b5) Return WordSpace: Sound C.5, (0,w3) Return '######################################################################### '######################################################################### '# '# LCD STUFF! LCD STUFF! LCD STUFF! LCD STUFF! LCD STUFF! LCD STUFF! '# '######################################################################### '######################################################################### '######################################################################### '# Initialise: '# This is for setting up the 2 x 16 LCD upon power up. ie. 8 bit mode, '# cursor on, cursor blinking etc. etc. '# '# You must initialise the LCD for it to work properly! This is done by '# sending instructions to the LCD after power up. Otherwise it will NOT '# work! Trust me. '# '# The LCD used is a JAYCAR Electronics part number #QP5515. It's a '# green non backlit 2 lines by 16 character LCD display. '# '# Sending the following instructions on Port B pins to the LCD equals: '# FUNCTION SET '# 56 = 8 Bit mode, 2 lines, 5x7 font. '# '# DISPLAY & CURSOR ON OR OFF '# 12 = Turns the display on and cursor off '# '# There are many other instructions that are not used in this project. '# Consult the full documentation that comes with your LCD. Normally '# the little cheat sheet that comes with the LCD does not contain this '# information. You may have to consult the manufactures web site. '# '######################################################################### Initialise: Let PinsB = 0 'turn off all outout pins on port B Let PinsB = 56 'Port B pins = %00111000 8-bit operation, 2 lines Low C.6 'Set R/S on LCD low Pulsout C.7, 1 '10uS pulse on C.7 LCD E "enable" PinsB = 12 'Port B pins = %00001100 Turn display on, cursor off Low C.6 'Set R/S on LCD low Pulsout C.7, 1 '10uS pulse on C.7 LCD E "enable" Return '######################################################################### '# WriteCharacter: '# This is for writing characters to be displayed on the LCD. ie. Lettrs, '# Numbers, Punctuation etc. etc. '# '# Output C.6 is the R/S line on LCD. High to write characters to the LCD '# and LOW to write instructions to the LCD '# '# Output C.7 is the E or "Enable" line on the LCD. Once the PICAXE '# presents the variable b51 onto the LCD's data lines, D0-D7, the E line '# needs to be pulsed for 10uS so the LCD can write the character to the '# LCD screen or the instruction into the LCD. '# '# LCD data pins D7=#,D6=#,D5=#,D4=#,D3=#,D2=#,D1=#,D0=# '# 128 64 32 16 8 4 2 1 '# '######################################################################### WriteCharacter: Let pinsB = b51 'put variable b51 onto Port B pins High C.6 Pulsout C.7, 1 '10uS pulse on C.7 LCD E "enable" Return '######################################################################### '# WriteInstruction: '# This is for writing instructions to the LCD. ie. Moving the cursor, '# clearing the screen etc. etc. '# '# Output C.6 is the R/S line on the LCD. High to write characters to the '# LCD and LOW to write instructions to the LCD. '# '# Output C.7 is the E or "Enable" line on the LCD. Once the PICAXE '# presents the variable b51 onto the LCD's data lines, D0-D7, the E line '# needs to be pulsed for 10uS so the LCD can write the character to the '# LCD screen or the instruction into the LCD. '# '# LCD data pins D7=#,D6=#,D5=#,D4=#,D3=#,D2=#,D1=#,D0=# '# 128 64 32 16 8 4 2 1 '# '######################################################################### WriteInstruction: Let pinsB = b51 'put variable b51, %######## onto Port B pins Low C.6 Pulsout C.7, 1 '10uS pulse on C.7 LCD E "enable" Return '######################################################################### '# ClearLCDScreen: '# This instruction clears the screen on the 2 x 16 LCD '# '# Let b51 = 1 = %00000001 '# LCD data pins D7=0,D6=0,D5=0,D4=0,D3=0,D2=0,D1=0,D0=1 '# 128 64 32 16 8 4 2 1 '# '######################################################################### ClearLCDScreen: Let b51 = 1 Gosub WriteInstruction Return '######################################################################### '# MoveCursorToSecondLine: '# This instruction moves the cursor to the beginning of the second line '# on the 2 x 16 LCD '# '# '# Let b51 = 192 = %11000000 '# LCD data pins D7=1,D6=1,D5=0,D4=0,D3=0,D2=0,D1=0,D0=0 '# 128 64 32 16 8 4 2 1 '# '######################################################################### MoveCursorToSecondLine: Let b51 = 192 Gosub WriteInstruction Return '######################################################################### '# MORSE CODE STUFF '# Encoded character numbers, NOT ASCII numbers. These numbers are for a '# "modulus divide" and a "shift right" in the Morse routine. '# '######################################################################### 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 ALL THE PUNCTUATION THAT YOU WILL PROBABLY EVER NEED :-) REM FULL STOP [.] .-.-.- COLON [:] ---... REM COMMA [,] --..-- SEMICOLON [;] -.-.-. REM QUESTION MARK [?] ..--.. EQUAL SIGN double dash [=] -...- REM APOSTROPHE ['] .----. PLUS [+] .-.-. REM EXCLAMATION MARK [!] -.-.-- HYPHEN minus [-] -....- REM FWD SLASH [/] -..-. UNDERSCORE [_] ..--.- REM PARENTHESIS open [(] -.--. QUOTATION MARK ["] .-..-. REM PARENTHESIS closed [)] -.--.- DOLLAR SIGN [$] ...-..- REM AMPERSAND [&] .-... AT SIGN [@] .--.-. REM *** ENCODED CHARACTER LETTERS *** REM A 6, B 17, C 21, D 9, E 2, F 20, REM G 11, H 16, I 4, J 30, K 13, L 18, REM M 7, N 5, O 15, P 22, Q 27, R 10, REM S 8, T 3, U 12, V 24, W 14, X 25, REM Y 29, Z 19, REM *** ENCODED CHARACTER NUMBERS *** REM 1 62, 2 60, 3 56, 4 48, 5 32, REM 6 33, 7 35, 8 39, 9 47, 0 63, REM *** ENCODED CHARACTER PUNCTUATION *** REM FULL STOP [.] 106 COLON [:] 71 REM COMMA [,] 115 SEMICOLON [;] 85 REM QUESTION MARK [?] 76 EQUAL SIGN double dash [=] 49 REM APOSTROPHE ['] 94 PLUS [+] 42 REM EXCLAMATION MARK [!] 117 HYPHEN minus [-] 97 REM FWD SLASH [/] 41 UNDERSCORE [_] 108 REM PARENTHESIS open [(] 45 QUOTATION MARK ["] 82 REM PARENTHESIS closed [)] 109 DOLLAR SIGN [$] 200 REM AMPERSAND [&] 34 AT SIGN [@] 86 '######################################################################### '# LCD INFORMATION AND NOTES '# Character ASCII numbers. '# '######################################################################### REM *** TYPICAL CHARACTERS USED FOR THE LCD *** REM LETTER BINARY DECIMAL # LETTER BINARY DECIMAL # REM A %01000001 65 N %01001110 78 REM B %01000010 66 O %01001111 79 REM C %01000011 67 P %01010000 80 REM D %01000100 68 Q %01010001 81 REM E %01000101 69 R %01010010 82 REM F %01000110 70 S %01010011 83 REM G %01000111 71 T %01010100 84 REM H %01001000 72 U %01010101 85 REM I %01001001 73 V %01010110 86 REM J %01001010 74 W %01010111 87 REM K %01001101 75 X %01011000 88 REM L %01001100 76 Y %01011001 89 REM M %01001101 77 Z %01011010 90 REM ALL UPPER CASE LETTERS! REM *** TYPICAL NUMBERS USED FOR THE LCD (future) *** REM NUMBER BINARY DECIMAL # NUMBER BINARY DECIMAL # REM 0 %00110000 48 5 %00110101 53 REM 1 %00110001 49 6 %00110110 54 REM 2 %00110010 50 7 %00110111 55 REM 3 %00110011 51 8 %00111000 56 REM 4 %00110100 52 9 %00111001 57 REM *** NOTES NOTES NOTES NOTES NOTES NOTES NOTES *** REM This is how it looks on the Port B pins REM D7.....D0 REM | | REM | | REM V V REM %00000000 REM LCD data pins D7=0,D6=0,D5=0,D4=0,D3=0,D2=0,D1=0,D0=0 REM 128 64 32 16 8 4 2 1 REM Example.... REM Decimal 63 = D7=0 D6=0 D5=1 D4=1 D3=1 D2=1 D1=1 D0=1 REM Add them up --> 0 0 32 16 8 4 2 1 = 63 REM So, 63 = %00111111 and ASCII #63 is a "Question Mark" REM D7=2^7 D6=2^6 D5=2^5 D4=2^4 D3=2^3 D2=2^2 D1=2^1 D0=2^0 '################################################################ '# *** PLEASE READ THE NOTES *** *** PLEASE READ THE NOTES *** # '################################################################ 'A place I leave myself notes for slot #2.