[ntp:questions] Sure GPS: Programming it now works
Terje Mathisen
"terje.mathisen at tmsw.no" at ntp.org
Tue Apr 5 18:06:02 UTC 2011
unruh wrote:
> On 2011-04-05, Terje Mathisen<"terje.mathisen at tmsw.no"> wrote:
>> I haven't tried without, and it does protect against some line errors,
>> so why not?
>
> because if you are generating the lines by hand and sending it to the
> chip via say minicom with the Y option, calculating the checksum is not
> trivial. By the way is it everything between the $ and the * or does it
> include the $ and *?
I think I'll make a trivial addition to my little hack:
An option to send an arbitrary command:
Something like
-p port (default COM1)
-b baud (default 9600)
-s string (send $string*xxCRLF to mtk
>
>>
>> The calculation is after all really trivial:
>>
>> len = strlen(buffer);
>> // Add trailing '*' if missing:
>> if (buffer[len-1] != '*')
>> buffer[len++] = '*';
>> // XOR sum of all bytes, except the first and last:
>
> OK, you are saying, omit the $ and *
Right.
Terje
--
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"
More information about the questions
mailing list