I dont know if anyone has done anything similar but here is code that can be used to transmit a static message (callsign) along with three ADC values using morse code. It simply pulses an output using a binary representation for morse characters. It was written for a -08M and uses nearly all of the memory. It was used as a backup data system on a high altitude balloon and worked beautifully except our transmitter was too weak once we got to ~90,000 feet . We also used it to do Directional Finding when recovering the balloon.
Dont worry about the stuff at the top. It is my attempt at doing modular code and its still being evolved.
Any comments would be appreciated.
Thanks,
Daniel
Code:
;Standard Register Structure
;******************************************
Symbol I1 = b0 'Index 1 *
Symbol I2 = b1 'Index 2 *
Symbol I3 = b2 'Index 3 *
Symbol T1 = b3 'Temp 1 *
Symbol T2 = b4 'Temp 2 *
Symbol T3 = b5 'Temp 3 *
Symbol P1 = b6 ;Data Pointer 1(Input) *
Symbol P2 = b7 ;Data Pointer 2(Input) *
Symbol P3 = b8 ;Data Pointer 3(Input) *
Symbol P4 = b9 ;Data Pointer 4(Output) *
Symbol P5 = b10 ;Data Pointer 5(Output) *
Symbol P6 = b11 ;Data Pointer 6(Output) *
Symbol R1 = b12 ;Random Variable 1 *
Symbol R2 = b13 ;Random Variable 2 *
;******************************************
'Note: Binary representation of morse code
'uses the 3 LSB's to represent the number of
;Dits/Dahs in the morse character. The
'remaining MSB's represents the actual Dits/Dahs
;load the morse equivalent numbers 0-9 into eeprom
;addressed at their decimal ascii value
data 48,(253,125,61,29,13,5,133,197,229,245)
; 0 1 2 3 4 5 6 7 8 9
;load the morse equivalent alphabet into eeprom
;addressed at their decimal ascii equivalent
data 65,(66,132,164,131,1,36,195,4,2,116,163,68,194,130,227,100,212,67,3,129,35,20,99,148,180,196)
; A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
'load static message note: only use capital letters
data 0,("K","J","4","H","V","J",0) '0 represents a space
Symbol Dit_length = 500 'set length of a dot in ms
Symbol Dah_length = Dit_length * 3
Symbol Wrd_length = Dit_length * 7
Start:
low 0 ;make sure output is off
pause 1500 ;pause 1.5 secs b/w transmissions
readadc 1,T1 ;read ADC values and store in memory
poke 80,T1
readadc 2,T1
poke 81,T1
readadc 4,T1
poke 82, T1
'Cycles through static message and ADC data and transmits
'Sends with P1,P2 recieves with P4,P5,P6
Main:
for I1 = 0 to 6 'send static message from
;0 to end of msg
read I1,P1 'get the character from the eeprom
gosub Morse 'go to the ch. generation routine
next 'loop back to get next ch. and load it
for P2= 80 to 82 ;adc data is stored in location 80-82
gosub convert ;convert adc data to three ascii char.
for I1 = 0 to 3
lookup I1, (P6,P5,P4,0),P1
gosub morse ;transmit hundreds,tens,ones,space
next
next
goto Start 'return to start to wait for next input
;toggles Pin 0 to send the Morse
;receives from P1, does not send
Morse:
if P1 = 0 then '0 represents a space
pause Wrd_length
return
endif
read P1,T1 'get binary morse representation from eeprom
let T2 = T1 & %00000111 'get the number of elements in morse character
for I3 = 1 to T2 'loop through to get all elements
if T1 >= 128 then 'test MSB for a 1
pulsout 0,Dah_length 'if so pulse long
else 'else pulse short
pulsout 0,Dit_length
endif
pause Dit_length 'pause between morse elements
let T1 = T1 * 2 'left shift morse character
next 'loop back to get the next element
pause Dah_length 'pause b/w letters
return
'converts binary numbers to their one,tens,hundreds representation then
'to their equivalent morse number
'receives on P2, sends on P4,P5,P6
Convert:
peek P2,T1 'grab value to convert
P4=T1//10+48 'get the ones place
P5=T1/10//10+48'get the tens place
P6=T1/100+48 ;get the hundreds place
'add 48 to get the ascii equivalent
read P4,P4 ;get the morse representations from eeprom
read P5,P5
read P6,P6
return
Dont worry about the stuff at the top. It is my attempt at doing modular code and its still being evolved.
Any comments would be appreciated.
Thanks,
Daniel
Last edited: