EasyManua.ls Logo

Huawei UPS2000 - Command Type and Format at the Application Layer; Function Code List; CRC Checking Algorithm

Huawei UPS2000
43 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
UPS2000-(6 kVA-20 kVA)
Modbus Protocol Development Guide
1 Communication Protocol
Huawei Proprietary and Confidential
Copyright © Huawei Technologies Co., Ltd.
1.5 Command Type and Format at the Application Layer
1.5.1 Function Code List
Function Code
Meaning
Remarks
0x03
Read command
Continuously read a single
or multiple registers.
0x06
Write single register
command
Write commands to a single
register.
0x2B
Read device identifier
command
N/A
1.5.2 CRC Checking Algorithm
unsigned short count_CRC(unsigned char *addr, int num)
{
unsigned short CRC = 0xFFFF;
int i;
while (num--)
{
CRC ^= *addr++;
for (i = 0; i < 8; i++)
{
if (CRC & 1)
{
CRC >>= 1;
CRC ^= 0xA001;
}
else
{
CRC >>= 1;
}
}
}
return CRC;
}

Related product manuals