Communication Protocol VD120 Series Inverter User Manual
-
162
-
check of complete data of format.
9.6.3.1 Byte check
User can select different check mode according to requirement, can also select no-check, but it will
affect the Bit setting of every byte check.
The meaning of even check: add a Bit of even parity check before data transmission, to express the
number of “1” in the transmission data is odd or even, if the number is even, check Bit is “0”,
otherwise it is set to “1” to Keep the parity of the data unchanged.
The meaning of odd check: add a Bit of odd parity check before data transmission, to express the
number of “1” in the transmission data is odd or even, if the number is odd, check Bit is “0”, otherwise
it is set to “1”. to Keep the parity of the data unchanged.
For example, the transmitting data “11001110”, there is 5 “1” in the data, if using even parity check,
the even check Bit is “1”, if using odd parity check, the odd check Bit is “0”, when transmitting data,
the parity check Bit will be processed and put at the position of format check Bit. And the receiving
device will also do parity check, if it found the parity of the received data is not the same as pre-set,
then it decides that communication was in error.
9.6.3.2 CRC check method
Use the RTU frame format, format include format error-checking field that is based on CRC method
calculation. The CRC field checks the contents of the entire format. The CRC field has two bytes ,
containing a 16-Bit binary value.
It is calculated by the transmission device to be added to the frame.
The receiving device recalculates the CRC of the received frame and compares it with the value in the
received CRC field. If the two CRC values are not equal, then the transmission has an error.
The CRC saves 0xFFFF at first, then call a process to deal with the successive 6 bytes of the format
and the value of present register. Only the 8Bit data of each byte is enabled for CRC, the starting Bit
and the end Bit and parity check Bit is all disabled.
During generation of the CRC, each 8-bit character is separate from the register contents or (XOR),
the results is shifting towards the lowest enabled Bit, the highest enabled Bit is filled with 0. LSB is
extracted to be checked, if LSB is 1, the register separate and preset values different or (XOR); if LSB
is 0, then no need. The complete process will be repeated for 8times. After completing of the last Bit
(the 8
th
Bit), the next 8-bit byte is separate or (XOR)from the current value of the register. The final
value of register is the CRC value of the all Bit executed of the frame.
The calculation of CRC, adopting the international standard CRC check regulation, when user is
editing CRC calculation, can relevant standard CRC algorithm to write the CRC calculation process of
truly meet the requirements.
Now provides a simple function of the CRC calculation to the user reference (C language
programming).
unsigned int crc_cal_value(unsigned char *data_value
,
unsigned char data_length)
{
int i;
unsigned int crc_value=0xFFFF;
while(data_length--)
{
crc_value^=*dat+;
For(i=0;i<8;i++)
{
iF(crc_value&0x0001)
crc_value=(crc_value>>1)^0xa001;
else
crc_value=crc_value>>1;
Содержание VD120 Series
Страница 2: ......