The device connects at 4800 baud and I think that the serial to USB converter buffers data. The GPS broadcasts it data with no flow control or request messages. I am interested in position data which is broadcast by the GPS once a second. I have managed to read my data and process it inside a handler that recalls itself on a timer but the process is very time dependant and I am sure that must be a better way.
Code: Select all
On readDataPort
global gTimerID
--Start Loop to search for words of interest
Repeat forever
Read from driver "/dev/cu.usbserial-FTBOBOGT" for 6 characters
If it is "$GPRMC" OR it is "$GPGGA" then
Read from driver "/dev/cu.usbserial-FTBOBOGT" until linefeed
--Now work on data sentence
Put it into field "thedata"
exit repeat
else
-- We are not interested in the data word found so prepare for next header
Read from driver "/dev/cu.usbserial-FTBOBOGT" until linefeed
end if
End Repeat
send readDataPort to me in 500 milliseconds
put the result into gTimerID
end readDataPort
Any thoughts or advice