Kruger Ecowatt K320 Series Operation Manual page 291

Variable frequency drive
Hide thumbs Also See for Ecowatt K320 Series:
Table of Contents

Advertisement

Ecowatt
Drive K320 series
®
The following example is a simple CRC calculation function for your reference (using the C
programming language):
unsigned
int
data_length)
{
int i;
unsigned int crc_value=0xffff;
while(data_length--)
{
crc_value^=*data_value++;
for(i=0;i<8;i++)
{
if(crc_value&0x0001)
else
}
}
return(crc_value);
}
In the ladder logic, CKSM uses the table look-up method to calculate the CRC value according
to the content in the frame. The program of this method is simple, and the calculation is fast,
but the ROM space occupied is large. Use this program with caution in scenarios where there
are space occupation requirements on programs.
9.4 RTU command code and communication data
9.4.1 Command code 03H, reading N words (continuously up to 16 words)
The command code 03H is used by the master to read data from the VFD. The count of data to
be read depends on the "data count" in the command. A maximum of 16 pieces of data can be
read. The addresses of the read parameters must be contiguous. Each piece of data occupies 2
bytes, that is, one word. The command format is presented using the hexadecimal system (a
number followed by "H" indicates a hexadecimal value). One hexadecimal value occupies one
byte.
For example, starting from the data address of 0004H, to read two contiguous pieces of data
(that is, to read content from the data addresses 0004H and 0005H) of the VFD whose address
is 01H, the frame structures are described in the following.
RTU master command (sent from the master to the VFD):
crc_cal_value(unsigned
crc_value=(crc_value>>1)^0xa001;
crc_value=crc_value>>1;
char*data_value,unsigned
-282-
Communication
char

Advertisement

Table of Contents
loading

Table of Contents