¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: RS232 for GPS on PIC (help!)


"msilv3r"
 

Thank you all. Great insights. I'm def gonna end up using the interrupt. This isn't that hard after all! I was actually just thinking of a similar algorithm to yours yhbcoggs. Awesome!

On a slight side note, so since this is 4800bps, I could safely assume that I will receive more than once time code per second. And that, I assume, is the ".ss" part of "hhmmss.ss" - So I could, assuming I was always connected, use a compare within this string to know when a second in time has occurred. Also, it seems like many instructions on the pic are executed within either the nanosecond range, or low microsecond range. Since I don't have that much code for the interrupts I could perhaps say its negligible time. I plan on using a 32.whatever oscillator and using an interrupt count to compare for each second (I stil have some research to do in that area). But then when should I have the clock sync? I think it makes more sense to use an oscillator as the timing mechanism then the string compare mentioned above. Or maybe moth? I was thinking maybe every five minutes I would have it sync with the GPS, just incase its off by a second or two. A bit of scattered thoughts here, sorry. Any thoughts?

--- In NEONIXIE-L@..., "yhbcoggs" <rdcjr@...> wrote:
True, you don't need to buffer up the whole line; I did it by just looking at the last 3 characters; Just write a state machine that goes something like:

Say the NMEA sentence with the time 00:31:07 looks like this:

$GPGGA,003107<don't care about the rest>

Each time you see a character (every time you get a serial rx interrupt):

If current character is a $, reset state to 0

If state is 0 and the next to last character was a G,
and the last character is a G, and the current character is an A set state to 1

If state is 1, watch for a comma, set state to 2

If state is 2, set H tens, set state to 3
If state is 3, set H ones, set state to 4
If state is 4, set M tens, set state to 5
If state is 5, set M ones, set state to 6
If state is 6, set S tens, set state to 7
If state is 7, set S ones, set state to 8

no matter what the state do these things:

next to last character = last character

last character = current character

Join [email protected] to automatically receive all group messages.