Tecorp HC2V8P43P7 [162/182] Crc16 function

Tecorp HC2V8G4055 [162/182] Crc16 function
High Performance Vector Control/Torque Control Inverter User Manual
140
Appendix A Modbus Communication Protocol
Register for function code characteristics of the inverter
Attached Table-5
Register
address
Meaning Range Read (R) and Write (W)
0xF080
Relative address of the
function code
See Attached Table-1
R/W
0xF081 Current value 0 ~ 65535 R/W
0xF082 Upper Limit 0 ~ 65535 R
0xF083 Lower Limit 0 ~ 65535 R
0xF084
Factory default value of the
function code
0 ~ 65535 R
It can write the function code No. into 0xF080 by reading and writing multiple register commands 0x17
firstly and then read several attributes of this function code.
6. CRC16 Function
unsigned int crc16(unsigned char *data,unsigned char length)
{
int i,crc_result=0xffff;
while(length--)
{
crc_result^=*data++;
for(i=0; i<8; i++)
{
if(crc_result&0x01)
crc_result=(crc_result>>1) ^0xa001;
else
crc_result=crc_result>>1;
}
}
return (crc_result=((crc_result&0xff) <<8) |(crc_result>>8) ) ;
//Exchange CRC16 check sum and bytes at
higher and lower orders
}
7. Case Study of Modbus Communication Control
Start No.1 inverter to perform forward rotation, and set the rotation velocity to 50.00Hz (indicating 5,000 internally) as
per the following commands:
Address
Function
code
Register
Address
Number
Bytes
Register
Contents
Check Sum
Request 0x01 0x10 0x8000 0x0002
0x04 0x0001,0x1388
0xCEFF
Response
0x01 0x10 0x8000 0x0004
None None 0xE80A
Read the operating frequency of No.1 inverter and the response operating frequency of the inverter is 50.00Hz:
Address
Function
code
Register
Address
Number Bytes
Register
Contents
Request 0x01 0x03 0x8136 0x0001 None 0x4C38
Response
0x01 0x03 None 0x02 0x1388 0xB512
No.1 inverter stops in the default mode:
Address
Function Register Register Contents Check Sum

Содержание

Скачать