Re: Parity calculations...

"Clifford Kelley" <[email protected]> Mon, 30 Aug 2004 22:25:49 -0700
Newsgroups gmane.comp.hardware.gps.opensource
Message-ID <006901c48f1a$f9b92a80$6401a8c0@cliffkelley>
Serguei,

Thanks very much.  I'll look at it to see how it could be merged in with the
code.

Cliff
----- Original Message ----- 
From: "Serguei Miridonov" <[email protected]>
To: <[email protected]>
Sent: Saturday, August 28, 2004 11:46 PM
Subject: [OpenSource_GPS] Parity calculations...


> Hello,
>
> Right now I'm playing with Magellan Sportrack Pro and its
> correlator: tracking Doppler frequency shift, reading
> navigation message, etc... I wrote a parity check function for
> this, it seems smaller than that one you use in OpenGPS
> project, so if you think that it can be merged into your code,
> please, use it as public domain program:
>
> const static char parbits[26] = {
> 0x13, 0x25, 0x0b, 0x16, 0x2c, 0x19, 0x32, 0x26,
> 0x0e, 0x1f, 0x3e, 0x3d, 0x38, 0x31, 0x23, 0x07,
> 0x0d, 0x1a, 0x37, 0x2f, 0x1c, 0x3b, 0x34, 0x2a,
> 0x16, 0x29,
> };
>
> int gps_word_parity_ok(unsigned long word)
> {
> register int i;
> register unsigned long b, w;
> register char s;
> int rc;
> s = 0;
> w = word;
> if (w & (1UL << 30)) {
> w ^= 0x3fffffc0;
> rc = -1;
> } else {
> rc = 1;
> }
> for (i = 0, b = (1 << 6); i < 26; i++, b <<= 1) {
> if (w & b) {
> s ^= parbits[i];
> }
> }
> return (s == (w & 0x3f) ? rc : 0);
> }
>
> word is 32 bits: bits 31 and 30 are D29 and D30 from previous
> word, bits 29..0 are from the current word including 6 parity
> bits. The function returns 0 if checksum is incorrect, +1 if
> the word is OK, and -1 if word is OK but 24 information bits
> must be inverted...
>
> BTW, did you check the TLM word in current signal from any SV?
> It seems that it contains the week number, like the word 3 in
> subframe 1.
>
> Best regards,
> Serguei Miridonov.
>
> P.S. Having real GPS receiver like this one from Magellan and
> programming it to see how real GPS stuff is working is a
> fun...
>
>
> _______________________________________________
> opensource_gps mailing list
> [email protected]
> http://lists.psas.pdx.edu/cgi-bin/mailman/listinfo/opensource_gps
>