Appendix 2 Use of MODBUS Communication
86
ulenth=9;
}
while(ulenth!=0)
{
crc^=*uptr ;
for(uindex=0;uindex<8;uindex++)
{
if((crc&0x0001)==0)
{
crc=crc>>1 ;
}
else
{
crc=crc>>1 ;
crc^=0xa001 ;
}
}
ulenth-=1 ;
uptr++;
}
return(((crc&0x00FF)<<8)|((crc&0xFF00)>>8));
}
Example of Command Application
[03H]
Reading of Single-character Command: read the single-character record content from
the specified code. The record content is divided into high 8 bits and low 8 bits and
becomes part of the response content in order.
Example: read the state of driver 1