
Page 73
Checking Response Packets
Main module, Read Holding Registers Response Example
CRC functions
Sub-functions
#define PacketLen
9
int status;
unsigned char receive_byte[PacketLen];
status =CheckCrc(receive_byte ,PacketLen);
unsigned int GenCrc( unsigned int Data, unsigned int Polynomial, unsigned int crc )
{
unsigned int ccc;
/* Reverse CRC >> Modicon Crc */
for(ccc=0; ccc<8; ccc++){
if( (Data ^ crc ) & 1 ){
crc = ( crc>>1 ) ^ Polynomial;
}
else{
crc >>= 1;
}
Data >>= 1;
}
return( crc&0xFFFF );
}
receive_byte is received data buffer
received data size is 9 Bytes
If( status == 0 ) “CRC Successful”
Else “CRC Error”
Содержание ACCURA 7500
Страница 6: ...Page 6 Standard Compliance Process Control Equipment E324900...
Страница 75: ......