$regfile = "2313def.dat" $crystal = 4000000 Dim Sendstring As String * 36 Dim Sendchar As String * 1 Dim Charcode As Byte Dim Dataindex As Byte Dim Charindex As Byte Dim Nextcharindex As Byte Dim Charstring As String * 12 Dim Stringlength As Byte Dim Codelength As Byte Dim Codeindex As Byte Dim Codeelement As String * 1 Dim Concatindex As Byte Soundpin Alias Pinb.0 Morsepin Alias Portb.0 'Set Speed and Dot, they determine the remaining constants Const Speed = 12 Const Dot = 600 / Speed Const Dash = 3 * Dot Const Letter = Dash Const Wordw = 7 * Dot Const Frequency = 500 Config Soundpin = Output Do Sendstring = " K 60 Then 'get ranknumber and looup corresponding morse string Dataindex = Charcode - 35 Charstring = Lookupstr(dataindex , Morse_alfabet) Lowerline Lcd Charstring 'get length of morse string Codelength = Len(charstring) 'for each character in this string For Codeindex = 1 To Codelength 'extract character Codeelement = Mid(charstring , Codeindex , 1) 'send dot sound If Codeelement = "." Then Sound Morsepin , Dot , Frequency 'send dash sound Else Sound Morsepin , Dash , Frequency End If 'wait dot time, but not after last character If Codeindex < Codelength Then Waitms Dot Next Codeelement 'if next character in sendstring is not "<", wait letter time Nextcharindex = Charindex + 1 Sendchar = Mid(sendstring , Nextcharindex , 1) Charcode = Asc(sendchar) If Charcode <> 60 Then Waitms Letter 'else wait dot time Else Waitms Dot End If End If Next Charindex Waitms 500 Loop End Morse_alfabet: Data "........." '# Data "........." '$ Data "........." '% Data "........." '& Data ".----." ' ' Data "-.--." ' ( Data "-.--.-" ') Data "........." '* Data "........." '+ Data "--..--" ', Data "-...._" '- Data ".-.-.-" '. Data "-..-." '/ Data "-----" '0 Data ".----" '1 Data "..---" '2 Data "...--" '3 Data "....-" '4 Data "....." '5 Data "-...." '6 Data "--..." '7 Data "---.." '8 Data "----." '9 Data "---..." ': Data "........." '; Data "........." '< Data "........." '= Data "........." '> Data "..--.." '? Data "........." '@ Data ".-" 'A Data "-..." 'B Data "-.-." 'C Data "-.." 'D Data "." 'E Data "..-." 'F Data "--." 'G Data "...." 'H Data ".." 'I Data ".---" 'J Data "-.-" 'K Data ".-.." 'L Data "--" 'M Data "-." 'N Data "---" 'O Data ".--." 'P Data "--.-" 'Q Data ".-." 'R Data "..." 'S Data "-" 'T Data "..-" 'U Data "...-" 'V Data ".--" 'W Data "-..-" 'X Data "-.--" 'Y Data "--.." 'Z