ProNet Series AC Servo User's Manual
- 151 -
ASCII mode:
Communication is ended with (0DH) - [carriage return] and (0AH) - [new line].
RTU mode:
When the time exceeds the sleep interval by at least 4 bytes transmission time while in the current communication speed,
it means the communication is finished.
Example:
The following example uses C language to generate CRC value. The function needs two parameters.
unsigned char * data;
unsigned char length;
The function will return unsigned integer type CRC value.
unsigned int crc_chk(unsigned char * data,unsigned char length){
int i,j;
unsigned int crc_reg=oxFFFF;
While(length- -){
crc_ reg ^=*data++;
for(j=0;j<8;j++){
If(crc_reg & 0x01){
crc_reg=( crc_reg >>1)^0xA001;
}else{
crc_reg=crc_reg >>1;
}
}
}
return crc_reg;
}