The Modbus protocol of the VFD is RTU mode and the physical layer is RS485.

10.3.1 RS485

The interface of RS485 works on semiduplex and its data signal applies differential transmission which is called balance transmission, too. It uses twisted pairs, one of which is defined as A (+) and the other is defined as B (-). Generally, if the positive electrical level between sending drive A and B is among +2–+6V, it is logic "1", if the electrical level is among -2V–-6V, it is logic"0".

485+ on the terminal board corresponds to A and 485- to B.

Communication baud rate means the binary bit number in one second. The unit is bit/s (bps). The higher the baud rate is, the quicker the transmission speed is and the weaker the anti-interference is. If the twisted pairs of 0.56mm(24AWG)is applied as the communication cables, the Max. Transmission distance is as below:

Baud rate

Max. transmission distance

Baud rate

Max. transmission distance

2400BPS

1800m

9600BPS

800m

4800BPS

1200m

19200BPS

600m

It is recommended to use shield cables and make the shield layer as the grounding wires during RS485 remote communication.

In the cases with less devices and shorter distance, it is recommended to use 120Ω terminal resistor as the performance will be weakened if the distance increase even though the network can perform well without load resistor.

10.3.1.1 Single application

Figure 1 is the site Modbus connection figure of single VFD and PC. Generally, the computer does not have RS485 interface, the RS232 or USB interface of the computer should be converted into RS485 by converter. Connect the A terminal of RS485 to the 485+ terminal of the VFD and B to the 485- terminal. It is recommended to use the shield twisted pairs. When applying RS232-RS485 converter, if the RS232 interface of the computer is connected to the RS232 interface of the converter, the wire length should be as short as possible within the length of 15m. It is recommended to connect the RS232-RS485 converter to the computer directly. If using USB-RS485 converter, the wire should be as short as possible, too.

Select a right interface to the upper monitor of the computer (select the interface of RS232-RS485 converter, such as COM1) after the wiring and set the basic parameters such as communication baud rate and digital check bit to the same as the VFD.

image.png

Figure 10-1 RS485 physical connection in single application

10.3.1.2 Multi-application

In the real multi-application, the chrysanthemum connection and star connection are commonly used.

Chrysanthemum chain connection is required in the RS485 industrial fieldbus standards. The two ends are connected to terminal resistors of 120Ω which is shown as figure 2. Figure 3 is the simply connection figure and figure 4 is the real application figure.

image.png

Figure 10-2 Chrysanthemum connection

image.png

Figure 10-3 Chrysanthemum connection

image.png

Figure 10-4 Chrysanthemum connection applications

Figure 5 is the star connection. Terminal resistor should be connected to the two devices which have the longest distance. (1# and 15#device)

image.png

Figure 10-5 star connection

It is recommended to use shield cables in multiple connection. The basic parameter of the devices, such as baud rate and digital check bit in RS485 should be the same and there should be no repeated address.

10.3.2  RTU mode

10.3.2.1 RTU communication frame format

If the controller is set to communicate by RTU mode in Modbus network every 8bit byte in the message includes two 4Bit hex characters. Compared with ACSII mode, this mode can send more data at the same baud rate.

Code system

· 1  start bit

· 7 or 8 digital bit, the minimum valid bit can be sent firstly. Every 8 bit frame includes two hex characters (0...9, A...F)

· 1  even/odd check bit . If there is no checkout, the even/odd check bit is inexistent.

· 1  end bit (with checkout), 2 Bit (no checkout)

Error detection field

· CRC

The data format is illustrated as below:

11-bit character frame (BIT1–BIT8 are the data bits)

Start bit

BIT1

BIT2

BIT3

BIT4

BIT5

BIT6

BIT7

BIT8

Check bit

End bit

10-bit character frame (BIT1–BIT7 are the data bits)

Start bit

BIT1

BIT2

BIT3

BIT4

BIT5

BIT6

BIT7

Check bit

End bit

In one character frame, the digital bit takes effect. The start bit, check bit and end bit is used to send the digital bit right to the other device. The digital bit, even/odd checkout and end bit should be set as the same in real application.

The Modbus minimum idle time between frames should be no less than 3.5 bytes. The network device is detecting, even during the interval time, the network bus. When the first field (the address field) is received, the corresponding device decodes next transmitting character. When the interval time is at least 3.5 byte, the message ends.

The whole message frame in RTU mode is a continuous transmitting flow. If there is an interval time (more than 1.5 bytes) before the completion of the frame, the receiving device will renew the uncompleted message and suppose the next byte as the address field of the new message. As such, if the new message follows the previous one within the interval time of 3.5 bytes, the receiving device will deal with it as the same with the previous message. If these two phenomena all happen during the transmission, the CRC will generate a fault message to respond to the sending devices.

The standard structure of RTU frame:

START

T1-T2-T3-T4(transmission time   of 3.5 bytes)

ADDR

Communication address: 0–247 (decimal system) (0   is the broadcast address)

CMD

03H:read slave parameters

06H:write slave parameters

DATA (N-1)

DATA (0)

The data of 2×N bytes are the main content of the   communication as well as the core of data exchanging

CRC CHK low bit

Detection value:CRC (16BIT)

CRC CHK high bit

END

T1-T2-T3-T4 (transmission time   of 3.5 bytes)

10.3.2.2 RTU communication frame error checkout

Various factors (such as electromagnetic interference) may cause error in the data transmission. For example, if the sending message is a logic "1", A-B potential difference on RS485 should be 6V, but in reality, it may be -6V because of electromagnetic interference, and then the other devices take the sent message as logic "0". If there is no error checkout, the receiving devices will not find the message is wrong and they may give incorrect response which cause serious result. So the checkout is essential to the message.

The theme of checkout is that: the sender calculate the sending data according to a fixed formula, and then send the result with the message. When the receiver gets this message, they will calculate anther result according to the same method and compare it with the sending one. If two results are the same, the message is correct. If not, the message is incorrect.

The error checkout of the frame can be divided into two parts: the bit checkout of the byte and the whole data checkout of the frame (CRC check).

Bit checkout of the byte

The user can select different bit checkouts or non-checkout, which impacts the check bit setting of each byte.

The definition of even checkout: add an even check bit before the data transmission to illustrate the number of "1" in the data transmission is odd number or even number. When it is even, the check byte is "0", otherwise, the check byte is "1". This method is used to stabilize the parity of the data. 

The definition of odd checkout: add an odd check bit before the data transmission to illustrate the number of "1" in the data transmission is odd number or even number. When it is odd, the check byte is "0", otherwise, the check byte is "1". This method is used to stabilize the parity of the data. 

For example, when transmitting "11001110", there are five "1" in the data. If the even checkout is applied, the even check bit is "1"; if the odd checkout is applied; the odd check bit is "0". The even and odd check bit is calculated on the check bit position of the frame. And the receiving devices also carry out even and odd checkout. If the parity of the receiving data is different from the setting value, there is an error in the communication. 

CRC check

The checkout uses RTU frame format. The frame includes the frame error detection field which is based on the CRC calculation method. The CRC field is two bytes, including 16 figure binary values. It is added into the frame after calculated by transmitting device. The receiving device recalculates the CRC of the received frame and compares them with the value in the received CRC field. If the two CRC values are different, there is an error in the communication.

During CRC, 0×FFFF will be stored. And then, deal with the continuous 6-above bytes in the frame and the value in the register. Only the 8Bit data in every character is effective to CRC, while the start bit, the end and the odd and even check bit is ineffective.

The calculation of CRC applies the international standard CRC checkout principles. When the user is editing CRC calculation, he can refer to the related standard CRC calculation to write the required CRC calculation program.

Here provided a simple function of CRC calculation for the reference (programmed with C language):

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^=*data_value++;

                   for(i=0;i<8;i++)

                   {

if(crc_value&0x0001)crc_value=(crc_value>>1)^0xa001;

                   else crc_value=crc_value>>1;

                   }      }

return(crc_value);

}

In ladder logic, CKSM calculated the CRC value according to the frame with the table inquiry. The method is advanced with easy program and quick calculation speed. But the ROM space the program occupied is huge. So use it with caution according to the program required space. 

上一章节 下一章节