>
> thanks for the suggestions, ill work on to that i have
> another question NMEA protocol from GPS is ASCII
> right? so do i need to convert it to decimal when
> programming my oopic when like when its finding '$' or
> the succeeding letters like "GPRMC" or can i just
> write it as it is?
>
>
>
____________________________________________________________________________________
> Never miss a thing. Make Yahoo your home page.
> http://www.yahoo.com/r/hs
>
You grab the char from the oSerialPort into a variable (Byte or oByte)
named, say, ch.
In your case statement in state 1, for example, you do something like
this:
MyState = 1 ' at the top of the code, outside any loop
Do ' the main processing loop
... do whatever
if MySerial.Received then
..ch = MySerial
..Select Case MyState
....Case 1
......if ch = "$" then
........MyState = 2
......end if
....Case 2
......if ch = "G" then
.........MyState = 3
......end if
.. and so on until
....Case <?>
......if ch = '.' then
........value = 0
........MyState = <?+1>
......end if
....Case<?+1>
......ch = ch - '0'
......if (ch >= 0) and (ch <= 9) then
........value = 10 * value + ch
......else ' we are out of digits
........MyState = <?+2>
......end if
from here you look for the next decimal point and do a similar
conversion on a 2d value the then set MyState to 1 - look for the next
message
The whole point of this excercise is to NOT hang waiting on chars.
Richard
....
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/oopic/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/oopic/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:oopic-digest@yahoogroups.com
mailto:oopic-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
oopic-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
No comments:
Post a Comment