B-20 F650 DIGITAL BAY CONTROLLER GEK-106310-AF
B.4 MODBUS DATA APPENDIX B: MODBUS PROTOCOL
0X99,0X59,0X58,0X98,0X88,0X48,0X49,0X89,0X4b,0X8b,
0X8a,0X4a,0X4e,0X8e,0X8f,0X4f,0X8d,0X4d,0X4c,0X8c,
0X44,0X84,0X85,0X45,0X87,0X47,0X46,0X86,0X82,0X42,
0X43,0X83,0X41,0X81,0X80,0X40 };
UCHAR chi;
UCHAR clo;
USHORT ui;
chi = 0xff;
clo = 0xff;
while(us--)
{ ui = chi ^ *p++;
chi = clo ^ hi[ui];
clo = lo[ui];
}
ui = chi;
ui = ui << 8;
ui = ui | clo; // Big-Endian format
return(ui);
}
If it is Little-Endian format the returned bytes must be interchanged: each unsigned 16 bit type's bytes need to be
swapped.