Re: Need a sysRPL CRC16 routine.
- From: "John H Meyers" <jhmeyers@xxxxxxxxxxxxxx>
- Date: Tue, 03 Apr 2007 18:30:31 -0500
On Tue, 03 Apr 2007 13:46:00 -0500, dot wrote:
What type of object do you mean by "message"?
The CRC16 is needed to satisfy the modbus message protocol. There is
a string of hex digits (depending on the modbus message) which will
need to be processed, and the resulting CRC16 values added in big
endian fashion (least significant byte then most significant byte).
The modbus message string becomes one long hex string.
Isn't the built-in hardware CRC that very same CRC-16?
It does not seem to be. The test message "0207" yielded 5B04h
and the reverse string, "0702" yields 0CA9h.
I need to end up with 1241h for the valid test message CRC16.
What object type was each "message," how did you create it,
and what internal function did you use for CRC?
("yielded" means when you did what?)
Even if you constructed a proper 2-byte hex string as input
(which can't be done via UserRPL), neither the BYTES nor CRC
nor OCRC etc. commands can be used as-is, because they
start performing CRC on a *prefix* to those actual bytes
(BYTES starts at the prolog and goes to the end of the object;
CRC starts at the "length" field and stops 4 nibbles short
of the end of the object, if the AUR is correct -- the latter
seems to have been specially designed to compute a library CRC).
I suppose that all might be done upon hex strings
(very slowly), but it sure would be nice to have
a straightforward *ML* function for the CRC
of an arbitrary *string* (no prolog, no length,
just the string itself) -- in general, this should
also accommodate "odd-nibble" strings and general hex strings,
whose internal structures are all identical
[prolog, length in nibbles (including length field itself), data]
Note that "user" binary objects are also hex strings,
but are fixed-length (16d nibbles of data):
#123456789ABCDEF0h \->H ==> E4A20 51000 0FEDCBA987654321
#1234567h \->H ==> E4A20 51000 7654321000000000
OTOH, "ABC" BYTES DROP \->H ==> E4A20 90000 7DC9 [four nibbles only]
And of course "ABC" \->H ==> C2A20 B0000 142434
So, umm, would "ABC" in my computer have the same or different CRC-16?
[r->] [OFF]
.
- References:
- Need a sysRPL CRC16 routine.
- From: dot
- Re: Need a sysRPL CRC16 routine.
- From: John H Meyers
- Re: Need a sysRPL CRC16 routine.
- From: dot
- Need a sysRPL CRC16 routine.
- Prev by Date: Re: Need a sysRPL CRC16 routine.
- Next by Date: Re: Alpha lock utility for the hp39 or hp 40
- Previous by thread: Re: Need a sysRPL CRC16 routine.
- Next by thread: Re: Need a sysRPL CRC16 routine.
- Index(es):
Relevant Pages
|