#picaxe 08m ' Maine Bugs Picaxe (08M) Project ' Logical Pin = (#) _____ (#) ' Vcc - [ |_| ] Ground ' serial in from PC / (5) [ ] (0) Led 1 & 2 / Attention line from PC ' Piezo Speaker (4) [ 08M ] (1) Voltage divider from 12V gel cell ' (3) [ ] (2) Temperature sensor ' ----- ' CIRCUIT MODS FOR THE CIACDA PROJECT ' ' 4K7 ' +v O--/\/\/\-------O-O---(3) [ Pin3 A momentary pushbutton is added ' | in the xpansion holes on logical ' { pushbutton pin 3 on the PICaxe. The pushbutton ' | is used to select the Morse code ' |---O-O speed you want to practice at. ' | ' --- ' = ' ----> Keying line to QRP rig ' | ' | ' / ' 1K |/ ' Pin1 ]-----------O/\/\/\-| 2N2222A Keying transistor ' |\. ' \ ' | ' | ' | ' | ' ___________ ' | | ' __________O --- ' _|__ | = ' | | | \ ' Gnd | O | / ' | | \ ' Pin2 ]-----------O-------->/ 10k pot 10K POTENTIOMETER is used ' | | \ to set beacon speed. DON'T ' +V | O | / install the temperature sensor ' |_|_| \ & 4.7K then use the remote sensor ' | | connector to attach the pot. ' | | ' | \ ' | / ' | \ 470 ohm ' |_________ / ' ' CICADA starts AND waits for you to press the pushbutton (randomizing all the while) ' It then reads the speed pot to set the sending speed. Values are 5,10,13,15,20,25 without FARNSWORTH ' followed by 5,10,13,15,20,25 WITH FARNSWORTH. ' You can set a bit flag in the program to turn on/off (PUN=1 PUN=0) sending the punctuation. ' After a complete set of 10 5 letter groups the CICADA waits for another button press to start another set. ' ASCII values of the characters sent are also transmitted out Pin0 at 4800 baud for display ' & copy verification on a PC... ' A SHORT course in Picaxe Input / Output designators. ' The commands in the Picaxe microprocessor refer to the Input/Output pins with ' their LOGICAL Input/Output addresses. The PHYSICAL address of the I/O pin is ' different. Here is a simple table of the pins: ' Logical pin # Physical pin # ' 0 7 ' 1 6 ' 2 5 ' 3 4 ' 4 3 ' 5 2 ' The LOGICAL pin #0 is shared by both the PC download cable AND one of the LEDs. ' For the Cricket to function properly, disconnect the downloading cable after the ' download procedure....now Logical pin #0 is not shared with anything... ' EEPROM (0,0,69,84,73,78,65,77,83,68,82,71,85,75,87,79) '>>ETINAMSDRGUKWO EEPROM (72,66,76,90,70,67,80,0,86,88,0,81,0,89,74,0) 'HBLZFCP>VX>Q>YJ> EEPROM (0,0,0,82,137,0,0,94,54,109,0,42,115,97,85,50) '>>>#$>>'()*+,-./ EEPROM (63,62,60,56,48,32,33,35,39,47) '0123456789 EEPROM (24,12,9,8,6,5,48,16,9,13,8,5) 'SPEED #s for 5,10,13,15,20 & 25 wpm ' regular & FARNSWORTH ' PICK A RANDOM # BETWEEN 0 AND 57 TO USE FOR TABLE POSITION ' TABLE POSITION (0-47) BEING THE MORSE CODE VALUE AND ' DATA @ POSITION = ASCII VALUE OF THE MORSE CHARACTER ' IF ASCII VALUE IS 0 THEN ILLEGAL MORSE CODE # SO PICK AGAIN ' FOR TABLE POSITION > 47 THEN ASCII VALUE = TABLE POSITION # ' AND MORSE CODE VALUE = DATA @ POSITION # 'Define the Input & Output lines Output 0 'Led #1 AND #2 output active low 0=Led on 1=Led off Input 1 'Analog voltage in from Battery Voltage divider Input 2 'Temperature Sensor 1-Wire Input Output 4 'Piezo sounder Output for Chirp Input 3 'Switch MOD input 'Define come constants used in generating Morse Code Symbol KEYpin=1 'KEY on logical pin1 Symbol ADCpin=2 'Speed pot on logical pin2 Symbol PZOpin=4 'Piezo sounder on logical pin4 Symbol Nutone=120 'Index loop tone pitch Symbol ACKton=127 'button press pitch Symbol Pitch=122 'Morse code pitch Symbol Mute=0 'Define some variables to hold variable data Symbol ELE=b11 'place to hold current transmittion element Symbol PUN=bit0 'To PUNCTUATE or not Symbol I=b1 'Loop variable for MORSE CHARACTER NUMBER Symbol J=b2 'Variable to hole practice speed Symbol Ntrchr= b3 Symbol ASCII=b5 'Variable holding ASCII DATA Symbol Ditlen=b4 'Variable holding the element data of the Morse speed value Symbol CHAR=b6 'Variable holding RANDOM CHAR Symbol Ntrwrd= b7 Symbol Dahlen=b8 ' successive bits in the Morse character Symbol Send=b9 ' Symbol Memdat=b10 Symbol RANCHR=w6 'Word length variable holding collective time of chirps Symbol CODE=b12 Init: Random RANCHR 'Get the next random character If Pin3=1 Then Init 'Wait for key down Down: Random RANCHR 'Get the next random character ' Sound PZOpin,(110,5) 'make a tone If Pin3=0 Then Down 'Now wait for key release P: ReadADC ADCpin,I 'read pot value CHAR=I/11 'adjust pot value to 1-24 '*************************************************************************************** ' ' FORCE A TEST SPEED HERE and SET PUNCTUATION flag ' ' CHAR 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 ' WPM 5 10 13 15 20 25 5 10 13 15 20 25 5 10 13 15 20 25 5 10 13 15 20 25 ' -----REGULAR---- |---FARNSWORTH---|-----REGULAR----- | ---FARNSWORTH--- ' -----------PUNCTUATION=0----------|----------PUNCTUATION=1------------- ' ' '*************************************************************************************** CHAR=2 'use this command to force a speed...testing WITHOUT a pot? 'COMMENT OUT WHEN YOU ARE USING A SPEED POT! ' ' use values of 1 - 24 PUN=CHAR/12 '0= NO puncuation 1=PUNCTUATE CHAR=CHAR//12 'ADJUST BACK TO 1-12 ' '*************************************************************************************** Picked: I=57+CHAR 'calc MORSE speed address Read I,Ditlen 'read Ditlen (speed value) for various speeds Ntrchr=Ditlen *3 Ntrwrd=Ditlen *4 'REALLY 7 but later will wait Ntrchr + Ntrwrd If CHAR <7 Then AOK Ditlen=5 'assign a FARNSWORTH speed If CHAR >9 Then AOK 'ok FARNSWORTH VALUE is correct Ditlen=9 'it is the other speed AOK: Dahlen= Ditlen *3 Group: ' Pause 2000 '2 sec delay before groups start J=0 'J = group counter for counting # of 5 letter groups sent Morse:For I= 1 to 5 '5 characters in each code group Nxtchr: Random RANCHR 'Get the next random character CHAR=CODE & 63 'only use a part of the random number register If CHAR>57 then Nxtchr 'only random numbers 0 to 57 are allowed... If CHAR>47 then Numbr 'number so it's OK If CHAR<32 Then Alpha 'alphabetic so it's OK too! If PUN=0 Then Nxtchr 'No punctuation! Punct: Numbr: ASCII=CHAR 'Morse code numbers have ASCII = code Read CHAR,CHAR If CHAR=0 then Nxtchr 'invalid Morse code? If CHAR=137 Then Fist '$ code value is handled special Goto Prep Alpha: Read CHAR,ASCII 'Fetch ASCII value of code If ASCII=0 Then Nxtchr 'Valid Morse code? Prep: Fist: ELE=CHAR//2 'Shift out the LSB..and save it! CHAR=CHAR/2 'Adjust Morse code value to new shifted value SEND=Ditlen 'Element time starts out as a Dit If ELE=0 then Dewit 'is the element to send actually a dit? Got1: Send=Dahlen 'Bit is a 1 so element is a dash, element time = 3 * Dit Dewit: ' High KEYpin Sound PZOpin,(Pitch,Send) 'Send the Morse code element ' Low KEYpin If CHAR=1 then Nomore 'is there a next element in character? Sound PZOpin,(Mute,Ditlen) ' an element length of silence (not adjusted for Farnsworth) Goto Fist 'send some more elements Nomore: '*************************************************************************************** ' ' SERIAL data is sent to a serial port on a PC or other serial device ' at a fixed baud rate of 4800 baud. ' '*************************************************************************************** Sertxd (ASCII) 'Send the ASCII character for the Morse code # Sound PZOpin,(Mute,Ntrchr) ;3 more Interdits of silence Next I Sound PZOpin,(Mute,Ntrwrd) 'more silence between groups Sertxd (13,10) 'Send an ASCII CR/LF J=J+1 If J<11 then Morse 'do 10 groups of 5 characters Goto Init 'start all over again!!!!!!! #terminal 4800