User’s Manual ver. 2.0
CD3200 up to110A
Honeywell
39
www.honeywell.com/imc
10.2.3 C Language CRC 16 Example
static short CRC16 (unsigned char *p_first,unsigned char *p_last)
{
unsigned int crc=0xffff;
short
j;
for
(;p_first<=p_last;+)
{
crc
^=
*p_first;
for(j=8;j>0;j--)
{
if(crc
&
0x0001)
{
crc = crc >> 1;
crc
^=
0xA001;
}
else
{
crc = crc >> 1;
}
}
}
return (crc);
}
10.2.4 Read Holding Registers (Read n Words) – Function 03
The message sent to the Controller to obtain the value of one or more registers comprises the
following eight bytes:
Addr. unit Func.
Address
1° word
N° of Word
CRC 16
3
3Hex
HI LO
HI
LO
HI LO
The normal reply will echo the first two characters of the message received followed by a single-
byte data byte count (which will not include itself or the CRC).
For this message, the count value equals the number of parameter values read multiplied by two.
Following the byte count, the specified number of parameter values are transmitted, followed by
the CRC16 bytes:
Addr. unit Func.
Cont.
1° Value
Last Value
CRC 16
3
3Hex
HI LO
HI LO
HI LO