Bootstrak Skip to main content

9. MODBUS Communication Protocol

Streszczenie: Protokół MODBUS RTU w KE300: struktura ramek, kody funkcji 03H i 06H, CRC, adresy parametrów oraz rejestrów sterujących i statusowych, kody błędów komunikacji i parametry grupy Pd.
EN: KE300 MODBUS RTU protocol: frame structure, function codes 03H and 06H, CRC, parameter and control/status register addresses, communication error codes and group Pd parameters.

Dotyczy: falownik wektorowy Micno KE300 (zasilanie 1AC/3AC 220 V, 3AC 380 V, 3AC 660 V; moce 0,4–630 kW)
Źródło: dokumentacja producenta (Micno KE300 Series Inverter User Manual); tabele przepisane z obrazów na tekst – opracowanie Multiprojekt

KE300 series inverter provides RS485 communication interface, and adopts MODBUS communication protocol. User can realize centralized monitoring through PC/PLC, host computer, and also can set inverter’s operating commands, modify or read function parameters, read operating status and fault information, etc.

 

9.1 About Protocol

This serial communication protocol defines the transmission information and use format in the series communication. It includes the formats of master-polling, broadcast and slave response frame, and master coding method with the content including slave address (or broadcast address), command, transmiting data and error checking. The response of slave adopts the same structure, including action confirmation, returning the data and error checking etc. If slave takes place the error while it is receiving the information or cannot finish the action demanded by master, it will send one fault signal to master as a response.

 

9.2 Application Method

The inverter could be connected into a “Single-master Multi-slave” PC/PLC control network with RS485 bus.

 

9.3 Bus Structure

(1) Interface mode

RS485

(2) Transmission mode

There provide asynchronous series and half-duplex transmission mode. At the same time, just one can send the data and the other only receives the data between master and slave. In the series asynchronous communication, the data is sent out frame by frame in the form of message.

(3) Topological structure

In Single-master Multi-slave system, the setup range of slave address is 0 to 247. 0 refers to broadcast communication address. The address of slave must be exclusive in the network. That is basic condition of MODBUS communication.

9.4 Protocol Description

KE300 series inverter communication protocol is a kind of asynchronous serial master-slave communication protocol. In the network, only one equipment (master) can build a protocol (Named as “Inquiry/Command”). Other equipments (slave) response “Inquiry/Command” of master only by providing the data, or doing the action according to the master’s “Inquiry/Command”. Here, master is Personnel Computer, Industrial control equipments or Programmable logical controller, and the slave is inverter or other communication equipments with the same communication protocol. Master not only can visit some slave separately for communication, but also sends the broadcast information to all the slaves. For the single “Inquiry/Command” of master, all of slaves will return a signal that is a response; for the broadcast information provided by master, slave needs not feedback a response to master.

9.5 Communication Data Structure

MODBUS protocol communication data format of KE300 series inverter is shown as following:

In RTU mode, the Modbus minimum idle time between frames should be no less than 3.5 bytes. The checksum adopts CRC-16 method. All data except checksum itself sent will be counted into the calculation. Please refer to section: CRC Check for more information. Note that at least 3.5 bytes of Modbus idle time should be kept and the start and end idle time need not be summed up to it.

The entire message frame must be transmitted as a continuous data stream. If a idle time is more than 1.5 bytes before completion of the frame, the receiving device flushes the incomplete message and assumes that the next byte will be the address field of a new message. Similarly, if a new message begins earlier than 3.5 bytes interval following a previous message, the receiving device will consider it as a continuation of the previous message. Because of the frame’s confusion, at last the CRC value is incorrect and communication fault will occur.

RTU frame format:

image.png

Frame

field

Description
STARTTransmission time

of 3.5 bytes

Slave addressCommunication address: 0 to 247
Command code03H: read slave parameters
06H: write slave parameters
DATA (N-1), DATA (N-2), …, DATA0Data: function code parameter address, the number of function code parameters, function code parameter, etc.
CRC low byte, CRC high byteDetection value: CRC value
ENDTransmission time of 3.5 bytes

9.6 Command Code and Communication Data Description

9.6.1 Command code:

Code 03H,03H – Read N Words

Command code 03H reads N words. (There are 12 characters can be read at the most.)

For example: The inverter start address F002 of the slave 01 continuously reads two consecutive values.

Master command information

image.pngRequest frame (master → slave)

FieldValue
Address01H
Command code03H
Start address high byteF0H
Start address low byte02H
Register number high byte00H
Register number low byte02H
CRC low byte56H
CRC high byteCBH

Slave responding information

image.pngResponse frame (slave → master)

FieldValue
Address01H
Command

code

03H
Byte number04H
Data

F002H high byte

00H
Data F002H low byte00H
Data F003H high byte00H
Data F003H low byte01H
CRC low byte3BH
CRC high byteF3H

9.6.2 Command code

:Code 06H,06H write– Write a word
Word

Command code 06H writes one word.

For example: Write 5000(1388H) into address F00AH, slave address 02H.

Master command information

image.pngWrite frame (command 06H)

FieldValue
Address02H
Command

code

06H
Data address

high byte

F0H
Data address low byte0AH
Data content high byte13H
Data content low byte88H
CRC low byte97H
CRC high byteADH

9.6.3 CRC checking


Checking

In RTU mode, messages include an error-checking field that is based on a CRC method. The CRC field checks the contents of the entire message. The CRC field is two bytes, containing a 16-bit binary value.

The CRC value is calculated by the transmitting device, which appends the CRC to the message. The receiving device recalculates a CRC during receipt of the message, and compares the calculated value to the actual value received in the CRC field. If the two values are not equal, an error results.

The CRC is started by 0xFFFF. Then a process begins of applying successive eight-bit bytes of the message to the current contents of the register. Only the eight bits of data in each character are used for generating the CRC. Start and stop bits, and the parity bit, do not apply to the CRC.

During generation of the CRC, each eight-bit character is exclusive ORed with the register contents. Then the result is shifted in the direction of the least significant bit (LSB), with a zero filled into the most significant bit (MSB) position. The LSB is extracted and examined. If the LSB was a 1, the register is then exclusive ORed with a preset, fixed value. If the LSB was a 0, no exclusive OR takes place. This process is repeated until eight shifts have been performed. After the last (eighth) shift, the next eight-bit byte is exclusive ORed with the register's current value, and the process repeats for eight more shifts as described above. The final contents of the register, after all the bytes of the message have been applied, is the CRC value.

When the CRC is appended to the message, the low byte is appended first, followed by the high byte. The following are C language source code for CRC-16.

image.png

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); }

9.6.4 Address definitionDefinition of communicationCommunication parameter

Parameter

Here is about address definition of communication parameter. It’s used to control the inverter operation, status and related parameter setting.

(1) The mark rules of function code parameters address:

The group number and mark of function code is the parameter address for indicating the rules.

P0~PF group parameter address:

High byte: F0 to FF, low byte: 00 to FF

A0 group parameter address:

High byte: A0, low byte: 00 to FF

U0 group parameter address:

High byte: 70H, low byte: 00 to FF

For example: P3-12, address indicates to F30C

PC-05, address indicates to FC05

A0-01, address indicates to A001

U0-03, address indicates to 7003

Note:
1.

  1. Group PF: Either the parameter cannot be read, nor be changed.
    2.
  2. Group U0: Only for reading parameter, cannot be changed parameters.
    3.
  3. Some parameters cannot be changed during operation; some parameters regardless of what kind of status the inverter in, the parameters cannot be changed. Change the function code parameters, pay attention to the scope of the parameters, units, and relative instructions.

Besides, due to EEPROM be frequently stored, it will reduce the lifetime of EEPROM. So in the communication mode, some function code needn’t be stored, only change the RAM value. To achieve this function, change high order P of the function code into zero.

Corresponding function code addresses are indicated below:

P0~PF group parameter address:

High byte: 00 to FF, low byte: 00 to FF

A0 group parameter address:

High byte: 40, low byte: 00 to FF

U0 group parameter address:

High byte: 70H, low byte: 00 to FF

For example:


P3-12, address indicates to 030C

PC-05, address indicates to 0C05

A0-01, address indicates to 4001

These addresses can only act writing RAM, it cannot act reading. When act reading, it is invalid address.

(2) Stop/start parameter address 

image.png

Parameter

image.png

address
Parameter description
1000* Communication setting value (-10000 to 10000) (decimal)
1001Running frequency
1002Bus voltage
1003Output voltage
1004Output current
1005Output power
1006Output torque
1007Running speed
1008DI input flag
1009DO output status
100AAI1 voltage
100BAI2 voltage
100CRadiator temperature
100DCounting value input
100ELength value input
100FLoad speed
Parameter addressParameter description
1010PID setting
1011PID feedback
1012PLC running process
1013HDI input pulse frequency, unit is 0.01 kHz
1014Feedback speed, unit is 0.1 Hz
1015Remain running time
1016AI1 voltage before calibration
1017AI2 voltage before calibration
1018Reserved
1019Linear speed
101ACurrent power on time
101BCurrent running time
101CHDI input pulse frequency, unit is 1 Hz
101DCommunication setting value
101EActual feedback speed
101FMain frequency A display
1020Auxiliary frequency B display

Note:

Communication setting value is the percentage of relative value, and 10,000 corresponds to 100.00%,
 -10000 corresponds to -100.00%.

To the data of frequency, the percentage is the percentage of relative maximum frequency (P0-10).

To the data of torque, the percentage is P2-10 (torque upper limit).

(3) Control command input to inverter (write only)

image.png

Command

word

address
Command function
20000001: forward running
0002: reverse running
0003: forward jog
0004: reverse jog
0005: coast to stop
0006: deceleration to stop
0007: fault reset

(4) Read inverter status: (read only)

image.png

Status

word

address
Status word function
30000001: forward running
0002: reverse running
0003: stop

(5) Parameters locking password check: (If the return is 8888H, it means the password check passes.)

image.png

Password

address

Content of input password
1F00*****

(6) Digital output terminal control: (write only)

image.png

Command

address

Command content
2001BIT0: reserved
BIT1: reserved
BIT2: RELAY1 output control
BIT3: RELAY2 output control
BIT4: HDO open collector output control

(7) Analog output AO1 control: (write only)

image.png

Command

address

Command content
20020 ~ 7FFF refers to 0% ~ 100%

(8) Analog output AO2 control: (write only)

image.png

Command

address

Command content
20030 ~ 7FFF refers to 0% ~ 100%

(9) Pulse output control: (write only)

image.png

Command

address

Command content
20040 ~ 7FFF refers to 0% ~ 100%

(10) Inverter fault code description:

image.png

Inverter

image.png

fault

address

Inverter fault

information

80000000: No fault
0001: Reserved
0002: Over current when acceleration
0003: Over current when deceleration
0004: Over current when constant speed running
0005: Over voltage when acceleration
0006: Over voltage when deceleration
0007: Over voltage when constant speed running
0008: Reserved
0009: Under voltage fault
000A: Inverter overload
000B: Motor overload
000C: Input phase failure
000D: Output phase failure
000E: Module overheat
000F: External fault
0010: Communication fault
0011: Contactor fault
0012: Current detection fault
0013: Motor autotuning fault
0014: Reserved
0015: Parameter R/W fault
0016: Inverter hardware fault
0017: Motor short circuit to ground fault
0018: Reserved
0019: Reserved
001A: Running time arrival
001B: Customized fault 1
001C: Customized fault 2
001D: Power on time arrival
001E: Off load
001F: PID feedback lost when running
0028: Fast current limiting over time fault
0029: Reserved
002A: Speed deviation oversize
002B: Motor over speed

9.6.5 Description dataData of communicationCommunication Fault Information (Fault Code)

Communication fault informationaddressFault (function description
80010000: No fault
0001: code)Password

image.png

error
0002:

Command

error
0003:

CRC check error
0004: Invalid address
0005: Invalid parameter
0006: Parameter changing invalid
0007: System locked
0008: EEPROM operating

9.7 PD Group Communication Parameter Description

image.png

ParameterNameFactory defaultSetting range
Pd-00Baud rate6005 (as printed in the source; most likely 5 = 9600 BPS)0: 300 BPS
1: 600 BPS
2: 1200 BPS
3: 2400 BPS
4: 4800 BPS
5: 9600 BPS
6: 19200 BPS
7: 38400 BPS

This parameter is used to set the data transmission rate between host computer and the inverter. Please note that baud rate of the host computer and inverter must be the same. Otherwise, the communication is impossible. The bigger baud rate is, the faster communication is.

image.png

ParameterNameFactory defaultSetting range
Pd-01Data format00: No check: data format <8,N,2>
1: Even parity check: data format <8,E,1>
2: Odd parity check: data format <8,O,1>
3: No check: data format <8,N,1>

The setting data format of host computer and inverter must be the same; otherwise, the communication is impossible.

image.png

ParameterNameFactory defaultSetting range
Pd-02Local address11 ~ 247, 0 is broadcast address

When the local address is set to be 0, that is broadcast address, it can realize the broadcast function of host computer.

Local address must be unique (except broadcast address). This is the base of point-to-point communication between host computer and inverter.

image.png

ParameterNameFactory defaultSetting range
Pd-03Response delay2 ms0 ~ 20 ms

Response delay: It refers to the interval time from the inverter finishes receiving data to sending data to the host computer. If the response delay is less than system processing time, then the response delay is based on the system processing time. If the response delay is more than system processing time, after the system processing the data, it should be delayed to wait until the response delay time arrives, then sending data to host computer.

image.png

ParameterNameFactory defaultSetting range
Pd-04Communication timeout0.0 s0.0 s: invalid
0.1 ~ 60.0 s

When the function code set to be 0.0 s, the communication timeout parameter is invalid.

When the function code set to be valid value, if the interval time between the communication and the next communication is beyond the communication timeout, the system will report communication failure error (Err16). At normal circumstances, it is set to be invalid. If in the continuous communication system, set the parameter, you can monitor the communication status.

image.png

ParameterNameFactory defaultSetting range
Pd-05Communication protocol selection10: Non-standard Modbus protocol
1: Standard Modbus protocol

PD-05=1: Select standard MODBUS protocol

PD-05=0: When reading the command, the slave return is one byte than the standard MODBUS protocol’s, for details refer to communications Data Structure of this protocol.

image.png

ParameterNameFactory defaultSetting range
Pd-06Communication read current resolution00: 0.01 A
1: 0.1 A

It is used to confirm the output current unit when communication reads output current.

Słowa kluczowe

Micno KE300, MODBUS RTU, RS485, ramka, frame, 03H, 06H, CRC, adres rejestru, register address, 2000H, 3000H, 8000H, Pd-00, prędkość transmisji, baud rate