From: Winston on
On 7/24/2010 4:09 PM, Grant wrote:
> On Sat, 24 Jul 2010 16:45:22 -0400, Jamie<jamie_ka1lpa_not_valid_after_ka1lpa_(a)charter.net> wrote:

(...)

>> I know the Doc's say Xor with characters between the $ and * how ever,
>> they don't really give you an example. I can only assume they are Xoring
>> each char maybe with FF and then summing..
>
> Start with zero in a checksum variable, XOR each char with that
> variable and store result to the variable, convert checksum to
> a pair of hex digits (since it may contain non-printable or
> control characters).

Doubtlessly someone has written a VB script which generates
the proper string (and checksum) based on pulldown menus and
radio button selections, though my casual Googling doesn't
reveal anything like that.

--Winston
From: Jamie on
Winston wrote:

> On 7/24/2010 4:09 PM, Grant wrote:
>
>> On Sat, 24 Jul 2010 16:45:22 -0400,
>> Jamie<jamie_ka1lpa_not_valid_after_ka1lpa_(a)charter.net> wrote:
>
>
> (...)
>
>>> I know the Doc's say Xor with characters between the $ and * how ever,
>>> they don't really give you an example. I can only assume they are Xoring
>>> each char maybe with FF and then summing..
>>
>>
>> Start with zero in a checksum variable, XOR each char with that
>> variable and store result to the variable, convert checksum to
>> a pair of hex digits (since it may contain non-printable or
>> control characters).
>
>
> Doubtlessly someone has written a VB script which generates
> the proper string (and checksum) based on pulldown menus and
> radio button selections, though my casual Googling doesn't
> reveal anything like that.
>
> --Winston
Although i haven't actually ran a test program on the algorithm
suggested here, there are plenty of example strings that one
could test against in the supplied PDF that was posted.

My self, I used Delphi as my first language because its fast to
code something simple..
Function ValidateCRC(CMDStr:string):Boolean;
Var
CRC,H:Byte;
I,Y:Integer;
H:String;
Begin
Result := true; // Incase it has no CRC in the string.
Y := Pos('*',CMDStr); // Look for CRC marker.
If Y = 0 Then Exit;
CRC := 0;
H := UpperCase(Copy(CMDStr,Y+1,2));
For I := 2 to Y-1 do CRC := CRC Xor ORD(CMDSTr[I]);
Result := IntToHex(CRC,2) = H;
End;


I just did that out of my head as a thought..



From: Grant on
On Sun, 25 Jul 2010 12:10:18 -0400, Jamie <jamie_ka1lpa_not_valid_after_ka1lpa_(a)charter.net> wrote:

>Grant wrote:
>> On Sat, 24 Jul 2010 16:45:22 -0400, Jamie <jamie_ka1lpa_not_valid_after_ka1lpa_(a)charter.net> wrote:
>>
>>
>>>Winston wrote:
>>>
>>>
>>>>On 7/24/2010 9:18 AM, Jamie wrote:
>>>>
>>>>
>>>>>Piglit wrote:
>>>>>
>>>>>
>>>>>>I have a SSF2929P gps module which I wish to enable the ZDA string.
>>>>>>If I apply power to the module it happily spits out data, finds
>>>>>>sattelites etc
>>>>>>and displays results on my terminal, but nothing I send to the module
>>>>>>will stop the flow of data and put it into a mode to accept the
>>>>>>commands.
>>>>>>I'm beginning to think comms with this thing is half duplex, not full
>>>>>>duplex.
>>>>>>If this is the case, how do I reverse the flow and make it listen ?
>>>>>>(Yes I do have Rx and Tx connected)
>>>>>>Cheers
>>>>>>M
>>>>>
>>>>>most devices have a protocol you need to follow....
>>>>
>>>>
>>>>Yup.
>>>>
>>>>http://www.gpsinformation.org/dale/nmea.htm
>>>>
>>>>
>>>>>most have a CRC system to deduce error, and also, some have a way
>>>>>to get out/in data mode like in the olds of external modems...
>>>>>etc...
>>>>>
>>>>>YOu need to read the data sheet on it..
>>>>
>>>>
>>>>This one?
>>>>http://www.element-14.com/community/servlet/JiveServlet/downloadBody/13410-102-1-42402/40.Sirf%20nmea%20ref%20manual.pdf
>>>>
>>>>
>>>>:)
>>>>
>>>>--Winston
>>>
>>>$PSRFxxx,x,x,x,x*xx<cr><lf>
>>>
>>> Is that what you're referring too?
>>>
>>> P.S.
>>> Make sure you send the CR and LF at the end..
>>>and of course, calculate the CRC, and there are
>>>no spaces.
>>>
>>> I know the Doc's say Xor with characters between the $ and * how ever,
>>>they don't really give you an example. I can only assume they are Xoring
>>>each char maybe with FF and then summing..
>>
>>
>> Start with zero in a checksum variable, XOR each char with that
>> variable and store result to the variable, convert checksum to
>> a pair of hex digits (since it may contain non-printable or
>> control characters).
>>
>> Grant.
>Well, that makes it easy. I've seen a variety of CRC's done ..
>
> One I did recently involved adding a 1 to the results to reverse it.

There's a few sorts of pre, post conditioning, XOR is only a parity
check, weak.

You could have checksum ignoring overflow, then 16 or 32 bit CRC, or
go even further to error locus and correction. Trouble with this
XOR scheme is that it may allow two 'wrongs' to make a right :(

Grant.
From: Winston on
On 7/25/2010 12:47 PM, Jamie wrote:

(...)

> Although i haven't actually ran a test program on the algorithm
> suggested here, there are plenty of example strings that one
> could test against in the supplied PDF that was posted.
>
> My self, I used Delphi as my first language because its fast to
> code something simple..
> Function ValidateCRC(CMDStr:string):Boolean;
> Var
> CRC,H:Byte;
> I,Y:Integer;
> H:String;
> Begin
> Result := true; // Incase it has no CRC in the string.
> Y := Pos('*',CMDStr); // Look for CRC marker.
> If Y = 0 Then Exit;
> CRC := 0;
> H := UpperCase(Copy(CMDStr,Y+1,2));
> For I := 2 to Y-1 do CRC := CRC Xor ORD(CMDSTr[I]);
> Result := IntToHex(CRC,2) = H;
> End;
>
>
> I just did that out of my head as a thought..

Cool!

--Winston
First  |  Prev  | 
Pages: 1 2 3
Prev: Charge Conservation: It's Ready
Next: bluffing fools