NMEA And APRS
Archiver
Posts: 46,084
I have the piece of code for copying data from GPS recievers, thanks. I was
hoping to capture an entire sentence, but now see that can't be done.
Now I have to reformat the data and send it out as telemetry. In APRS I
have to format the altitude (which was originally in meters) in feet and
make it fit a six character field with leading zeros.
My altitudes will be greater than 1000 feet and will climb higher than
100,000 feet on occasion. What's the best way (that is, the way that uses
the least amount of code space), to take a variable representing altitude
(which may range from 2200 feet to 115,000 feet) in feet and fitting it into
a six character field with leading zeros.
As an example, if the altitude is 5280 feet, then I need to serout "005280".
If the altitude is 12,123 feet, then I need to serout "012123". When I
serout the altitude data, it's going out with lots of other data. I don't
want to write three serout routines, it will waste a lot of my program
space.
I'm thinking about setting up some kind of variable that consists of 6 zeros
and then ORing in the altitude, if something like that is possible. Another
possiblity is to count the number of characters in the altitude and then
concatenate the proper number of zeros onto the front of it.
Any suggestions would be appreicated
Paul
hoping to capture an entire sentence, but now see that can't be done.
Now I have to reformat the data and send it out as telemetry. In APRS I
have to format the altitude (which was originally in meters) in feet and
make it fit a six character field with leading zeros.
My altitudes will be greater than 1000 feet and will climb higher than
100,000 feet on occasion. What's the best way (that is, the way that uses
the least amount of code space), to take a variable representing altitude
(which may range from 2200 feet to 115,000 feet) in feet and fitting it into
a six character field with leading zeros.
As an example, if the altitude is 5280 feet, then I need to serout "005280".
If the altitude is 12,123 feet, then I need to serout "012123". When I
serout the altitude data, it's going out with lots of other data. I don't
want to write three serout routines, it will waste a lot of my program
space.
I'm thinking about setting up some kind of variable that consists of 6 zeros
and then ORing in the altitude, if something like that is possible. Another
possiblity is to count the number of characters in the altitude and then
concatenate the proper number of zeros onto the front of it.
Any suggestions would be appreicated
Paul
Comments
Hi Paul -
>I have the piece of code for copying data from GPS recievers, thanks. I was
>hoping to capture an entire sentence, but now see that can't be done.
>
>Now I have to reformat the data and send it out as telemetry. In APRS I
>have to format the altitude (which was originally in meters) in feet and
>make it fit a six character field with leading zeros.
Why not keep it in meters, and convert it on the ground to feet ?
In essence that's a factor of 3 savings - if I understand the problem
correctly.
>My altitudes will be greater than 1000 feet and will climb higher than
>100,000 feet on occasion. What's the best way (that is, the way that uses
>the least amount of code space), to take a variable representing altitude
>(which may range from 2200 feet to 115,000 feet) in feet and fitting it into
>a six character field with leading zeros.
>
>As an example, if the altitude is 5280 feet, then I need to serout "005280".
>If the altitude is 12,123 feet, then I need to serout "012123". When I
>serout the altitude data, it's going out with lots of other data. I don't
>want to write three serout routines, it will waste a lot of my program
>space.
>
>I'm thinking about setting up some kind of variable that consists of 6 zeros
>and then ORing in the altitude, if something like that is possible. Another
>possiblity is to count the number of characters in the altitude and then
>concatenate the proper number of zeros onto the front of it.
Take a look at the STR modifier and the limited processing of string data.
That MAY help. STR can be used in DEBUG, Serin/Serout, or where ever I/O
data formatting is done.
>Any suggestions would be appreicated
I'm sure there are better suggestions, but that off the top of my head.
>Paul
Regards,
Bruce Bates
> telemetry. In APRS I
> >have to format the altitude (which was originally in meters)
> in feet and
> >make it fit a six character field with leading zeros.
>
> Why not keep it in meters, and convert it on the ground to feet ?
> In essence that's a factor of 3 savings - if I understand the problem
> correctly.
I wish I could. When posting a position in APRS you have to follow the
format of:
A. Six character field with leading zeros (if needed)
B. Altitude in feet
Of course, if I had it my way..........
Paul
have you seen the Tiny Trak? It's a PIC based APRS beacon that
handles all of the formatting (you don't even need a TNC).Sounds alot like
what you are trying to do. Check:
http://www.byonics.com/home.html
Best, Duncan
> have you seen the Tiny Trak? It's a PIC based APRS beacon that
> handles all of the formatting (you don't even need a
> TNC).Sounds alot like
> what you are trying to do. Check:
>
> http://www.byonics.com/home.html
I'm using similar things. I need to add a level of complexity to it,
though, by having the BS-2 send additional telemetry.
Paul