Hello Dave,
trying to follow what is going on in the pointer call. $82 = N....not following, can you clarify?
Nick
Hello Dave,
trying to follow what is going on in the pointer call. $82 = N....not following, can you clarify?
Nick
Well it's quite simple, The 3 least significant bits are how many DIT's or DAH'S make up the character. The most significant 5 bits make up the message of DIT'S or DAH'S. The 1's are DAH'S and the 0's are DIT'S from left to right. The program mearly loops the number of dit's or dah's and depending on the state of the most significant bit, generates the appropriate dit or dah. The character is then left shifted for the next dit or dah. Understand? I had to make the code compact as the 10F222 only has 512 bytes of flash memory and 23 bytes of ram.....
Dave Purola,
N8NTA
EN82fn
That's a very nice method, Dave. It won't accommodate a comma, question mark, or any character with more than five elements, but you probably don't need those characters in that application.
One method I've used involves inserting a single '1' bit terminator after the last element. This allows for characters or pro-signs up to seven elements in length and eliminates the need for an element counter. A space character is empty except for the terminator bit ('10000000'). Processing the dits and dahs is similar to the method in Dave's example.
Code:id retlw b'10010000' ; 'd', dah-di-dit retlw b'01000000' ; 'e', dit retlw b'10000000' ; ' ', space retlw b'10110000' ; 'k', dah-di-dah retlw b'11100100' ; '8', dah-dah-dah-di-dit retlw b'01001000' ; 'l', di-dah-di-dit retlw b'00001000' ; 'h', di-di-di-dit retlw b'10010100' ; '/', dah-di-di-dah-dit retlw b'01010000' ; 'r', di-dah-dit retlw 0 ; end-of-table
Mike, Dave,
Great job, very nicely done! I will use this method when optimising my code. I have it working via sub calls and it is working nicely. I have to add program mode (to alter the parameters of my repeater including call sign), add a serial display for remote mounting along with a keypad. All of which I have written in modular form for other projects. I need to message it all together...LOL....yeah like that ever goes smoothly. I will post the code when I am done, since this is not propietary or for a client.
Nick
Hi Nick,
Glad to hear you've got it up-n'-runnin'.
If you were to try that other character format you'd need to change the algorithm. I don't have PBP but I think it would use one less variable (below). Other than that, the algorithms are so close I'm not sure there would be any advantage using one format over the other.
I'd love to see your code when you're finished (is there such a thing as "finished"?)...
Cheerful regards, Mike, K8LH
<note> that outer loop doesn't look quite right, does it?
Code:while idchar <> 0 ' lookup pointer,[$90,$40,$80,$B0,$E4,$48,$08,$94,$50,$00],idchar ' " d e k 8 l h / r " if idchar = 128 then ' if <space> char pause wordtime ' do word space else ' otherwise while idchar <> 128 ' while unprocessed bits if idchar.7 = 1 then ' sound data_out,[freq,dah] ' do 'dah' else ' sound data_out,[freq,dit] ' do 'dit' endif ' data_out = 0 ' force output to 0 pause interditdah ' 1 dit space idchar = idchar << 1 ' prep for next bit wend ' pause chartime ' pause between chars endif ' pointer = pointer + 1 ' bump table pointer wend '
Last edited by Mike, K8LH; - 28th March 2012 at 18:55.
Dave,
I'm running an assembly language version of your program on a 10F200 (100 words of memory) and it works great.
Mike, <note> that outer loop doesn't look quite right, does it? The outer loop allows the lookup table statement to be dynamic in nature. If one decides to, there can be multiple lookup statements for messages with out having to place a separate variable for the length of each of the messages. It was designed to to have the spare input bit possibly select another message if triggered by a branch statement.
Dave Purola,
N8NTA
EN82fn
Bookmarks