Hello Fox,
Fox>>ok, im trying to figure out how to at least transmit the TTY tones... the only way i can think of doing it is using a crapload of If-Then statements. Kinda like this...
IF key="A" THEN
FREQOUT PORTB.1,40,1800
FREQOUT PORTB.1,40,1800
FREQOUT PORTB.1,40,1800
FREQOUT PORTB.1,40,1400
FREQOUT PORTB.1,40,1400
end if
then have the same for the rest of the characters. But i think it would be better to put whatever they keyboard data that comes by into memory, that way there is a buffer... but i have no idea how to do that.
Any other suggestions on how to do this?
<<
Ouch...Lets think about this a second ok? There are a couple of options.
It would be much better to represent your letters in a numeric or bionary form.
Letting one tone be 1's and the other be zeros'. but that poses a slight problem, because how are you going to represent letters that have 3 of the same tones, verse 2 of the same tones? One way to do this, it to have representations of one tone in one variable, and representation of the other tone in another variable.
Lets let one tone represent 1800hz and the other tone represent 2150hz ( I like thinking of it in "tones" instead of Mark,stop, space, and start bits.
Lets look at Morse code (which the idea is similiar to Baudot, except it uses 6 possible bits to print out the ASCII characters that Hams use.
T=_
M=_ _
O=_ _ _
9=_ _ _ _.
Notice the problem concerning the dashes or spaces? Using just a 1 and zero will not truely represent and differentiate between the characters.
T=0
M=00
O=000
9=00001
which all 3 equate to zero and if you attempt to use 1's to present dashes, you run into the same problem using 0's to represent the "dits".
One way to do such a thing, is the following: (letting 1 equate to dits)
Vs Var byte (keeps track of the dits...shorts)
Vl Var Byte (Keeps track of the dashes...long)
T:
Vs=%00000000
Vl= %00000001
$00,$01
0:
Vs=%00000000
Vl= %00000111
$00,$07
Now, lets take a "complicated" character... Like the period. It is of 6 characters in Morse, and baudot is in 5... but the same principal applies
.:
.-.-.-
Vs=%00101010
Vl =%00010101
$2A $15
Now, with this in mind, we can play a game of receive/shift!
Loop:
Vs=0;
Vl=0;
counter=0;
Loop2:
receive tone
if Tone length = correct (because you may have a 'pause')
{
(and a pause generates a tone!)
(on some machines! )
switch Tone
case tone=low
Vs[0]=1;
Vl[0]=0;
Vs<<1
Vl<<1
case tone=high
Vs[0]=0;
Vl[0]=1;
Vs<<1
Vl<<1
endswitch
counter =counter+1;
}endif (counter less than 6)
if counter<6 goto Loop2 (hey, get next tone!)
if counter =6 then Loop1 (error, too many tones)
}endif
Vs, and VL have your data , you could combine them into 1 word if you want, instead of 2 separate bytes.
Now you can do a couple of things from here... either a table lookup, or
a if/case statement.
switch VsVl
case VsVl=$0007
Print "O"
case VsVl=$2A15
Print "."
etc. etc. etc.
Last edited by Dwayne; - 10th March 2005 at 22:18.
Reason: mistyped counter
Ability to Fly:
Hurling yourself towards the ground, and missing.
Engineers that Contribute to flying:
Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute
Pilots that are Flying:
Those who know their limitations, and respect the green side of the grass...
Bookmarks