CW Flasher
Greetings, everyone.
I just bought the 'What is a Microcontroller' kit from RS last week hoping to make a few different projects.
I am starting with trying to make a LED flash CW. I started writing the code with the references for each letter, and then I found this code at http://www.qsl.net/kc8qno/Files/beacon_key(trans).bs2
I am trying to learn his code, but he says no support is available, so I didn't bother him.
*EDIT* I deleted the code that was here, it was malfunctioning code, and made for a long thread /EDIT
I realize that it is converting binary into dits and dahs, but how???
And what does changing the number in ELEMENTS do.
Feel free to start with a hint to point me in the right direction to finding my own answer. =]
Jason
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sick and tired of our media and the cheesy radio DJ's in the US? http://www.opieandanthony.com
Post Edited (n1iic) : 7/19/2005 9:12:01 PM GMT
I just bought the 'What is a Microcontroller' kit from RS last week hoping to make a few different projects.
I am starting with trying to make a LED flash CW. I started writing the code with the references for each letter, and then I found this code at http://www.qsl.net/kc8qno/Files/beacon_key(trans).bs2
I am trying to learn his code, but he says no support is available, so I didn't bother him.
*EDIT* I deleted the code that was here, it was malfunctioning code, and made for a long thread /EDIT
I realize that it is converting binary into dits and dahs, but how???
And what does changing the number in ELEMENTS do.
Feel free to start with a hint to point me in the right direction to finding my own answer. =]
Jason
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sick and tired of our media and the cheesy radio DJ's in the US? http://www.opieandanthony.com
Post Edited (n1iic) : 7/19/2005 9:12:01 PM GMT

Comments
Consider SOS
Where (EP) = element pause, (CP) =character pause and (WP) = word pause
S O S
dit dit dit dah dah dah dit dit dit
dit (EP) dit (EP) dit (CP) dah dah dah (CP) dit (EP) dit (EP) dit (WP) dit (EP) dit (EP) dit (CP) dah dah dah (CP) dit (EP) dit (EP) dit
The subroutines are for each of the individual elements..... Dit, Dah, Element pause, Character pause, and word pause. Then the subroutines are called as necessary. Now the output pin 1 was probably used to key a relay via a transistor driver that operated the radio.
If you are actually trying to learn Morse Code, there are much better ways. Looking at the code written in dits and dahs is THE ABSOLUTE WORST way to learn the code for a number of reasons. Try the www.arrl.org website. or Google 'morse code'.
73 de KD5GKD
This project is going to flash a matrix of LED's that have replaced a bulb inside a colored dome, and will be used at hamfests to send code. This is only a grins and giggles project.
What I am trying to figure out is how it converts the DEC 20 into a V. It is not obvious in the code, and I do not understand enough of this yet.
Thanks
Jason
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sick and tired of our media and the cheesy radio DJ's in the US? http://www.opieandanthony.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
Post Edited (Paul Baker) : 7/19/2005 2:58:44 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sick and tired of our media and the cheesy radio DJ's in the US? http://www.opieandanthony.com
I am a little puzzled why I can't move subroutines around, but that will come in time.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sick and tired of our media and the cheesy radio DJ's in the US? http://www.opieandanthony.com
Paul got it the first time. Hope this visual helps.
Bit #················ 7···· 6···· 5··· 4··· 3·· 2·· 1·· 0
bit value········· 128·· 64·· 32·· 16·· 8·· 4·· 2·· 1
B···················· 1···· 0···· 0··· 0·····0···1·· 0··· 0················ = 132
E···················· ·0··· 0···· 0··· 0··· 0····0·· 0··· 1················ = 1
A······················0····1···· 0··· 0··· 0··· 0··· 1··· 0··············· = 66
C····················· 1··· O···· 1··· 0··· 0··· 1··· 0··· 0··············· = 164
O····················· 1···· 1···· 1··· 0··· 0··· 0··· 1··· 1············· = 227
N····················· 1····· 0····0···· 0··· 0··· 0··· 1··· 0············ = 130
This is just a visual of what Paul was saying. The upper 5 bits represent the character in dahs ( 1 )·and dits ( 0 ) and the lower three bytes represent the number of elements in character b= 1 000 + 0100 or Dah dit dit dit ( an "extra" or unused bit) + the lower bits 0100 telling the subroutine that there are 4 elements in the character. It's a much more elegant method than what I used. Hope this helps.
Then declare
·If you define all of the morse charactors, creating lookup strings·is an easier task.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
Very out of the box!
Thank You for your help, gentlemen. It would have been a long time before I understood it. I will let you know how the "drinking light" project comes along.
If anyone makes it to Hosstraders hamfest here in NH, let me know.
Jason
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sick and tired of our media and the cheesy radio DJ's in the US? http://www.opieandanthony.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
' {$STAMP BS2} ' {$PBASIC 2.5} 'KC8QNO Beacon Software for the Basic Stamp 2 Upgraded by n1iic July 2005. Verison 2.0 'Pin 1 controls the morse key on the rig 'Pin 2 controls the LED on the Stamp 'The Uniden HR2510 radio that KC8QNO used has a PTT toggle, so no PTT control here. Easy ' to add if you like. 'I took KC8QNO's original code, and added constants for letters, numbers, and some ' prosigns and punctiation to allow easier programming for the charaters to be sent. He ' originally used it for a 10 meter beacon. 'I would have done international characters, but I can't make them on my keyboard. 'This code functions with the 5 upper bits as the morse flags, and the last 3 bits ' as the character length. 10000101 is the numeral six. 10000 is the morse charcter, ' and 101 is binary for 5, the length of the character. 00000001 is E. 'To conserve space, use decimal instead of the constants as done originally by KC8QNO ' and delete the letter/number/prosign portion of the init subroutine. GOSUB init IDENTIFY: FOR INDEX1 = 0 TO 4 LOOKUP INDEX1,[noparse][[/noparse]n,one,i,i,c],CHARACTER GOSUB MORSE NEXT PAUSE 1000 FOR INDEX1 = 0 TO 7 LOOKUP INDEX1,[noparse][[/noparse]d,r,i,n,k,i,n,g],CHARACTER GOSUB MORSE NEXT PAUSE 1000 FOR INDEX1 = 0 TO 4 LOOKUP INDEX1,[noparse][[/noparse]l,i,g,h,t],CHARACTER GOSUB MORSE NEXT PAUSE 1000 RETURN MORSE: ELEMENTS = CHARACTER & %00000111 IF ELEMENTS = 7 THEN ADJUST1 IF ELEMENTS = 6 THEN ADJUST2 BANG_KEY: FOR INDEX2 = 1 TO ELEMENTS IF CHARACTER >= 128 THEN DAH GOTO DIT REENTER: CHARACTER = CHARACTER * 2 NEXT GOSUB CHAR_SP RETURN ADJUST1: ELEMENTS = 6 GOTO BANG_KEY ADJUST2: CHARACTER = CHARACTER & %11111011 GOTO BANG_KEY DIT: HIGH 2 LOW 1 PAUSE 175 LOW 2 HIGH 1 PAUSE 125 'Letter Speed (DIT and DAH must match here or the code GOTO REENTER 'sounds funny DAH: HIGH 2 LOW 1 PAUSE 375 LOW 2 HIGH 1 PAUSE 125 'Letter Speed (DIT and DAH must match here or the code GOTO REENTER 'sounds funny CHAR_SP: LOW 2 HIGH 1 PAUSE 500 'Time Between Letters (Characters) RETURN INIT: INDEX1 VAR Byte INDEX2 VAR Byte ELEMENTS VAR Byte CHARACTER VAR Byte DELAY CON 1500 II VAR Byte A CON 66 B CON 132 c CON 164 d CON 131 E CON 1 f CON 36 g CON 195 h CON 4 i CON 2 j CON 116 k CON 163 l CON 68 m CON 194 N CON 130 O CON 227 p CON 148 q CON 212 r CON 67 s CON 3 t CON 129 u CON 35 v CON 20 w CON 99 x CON 148 y CON 180 z CON 196 zero CON 253 one CON 125 two CON 61 three CON 29 four CON 13 five CON 5 six CON 133 seven CON 197 eight CON 229 nine CON 245 slash CON 149 equals CON 141 ar CON 85 as CON 69 bt CON 142 kn CON 181 sk CON 45 RETURN 'Block of original code ' FOR INDEX1 = 0 TO 5 ' LOOKUP INDEX1,[noparse][[/noparse]163,164,229,212,130,227],CHARACTER 'KC8QNO ' GOSUB MORSE ' NEXT ' PAUSE 1000It's really bloated, but at least it now has comments. The fluff and the constants can be axed if the space is critical.
Now to figure out the best way to build LED replacements for the bulbs, and to find a good price on white LED's.
In the 2nd version of the hardware I want to have chasing rows or columns. If I REALLY get ambitious, a matrix so I can scroll letters.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sick and tired of our media and the cheesy radio DJ's in the US? http://www.opieandanthony.com