6. MODBUS Interface – Transmission Modes and Function Codes
Streszczenie: Protokół MODBUS w NA-9473, część 1: tryby transmisji RTU i ASCII (budowa ramek), obsługiwane kody funkcji 1, 2, 3, 4, 5, 6, 8, 15, 16 i 23 z przykładami ramek zapytania i odpowiedzi, podfunkcje diagnostyczne (liczniki, reset, status FnBus) oraz odpowiedzi błędu i kody wyjątków.
EN: MODBUS interface, part 1: RTU/ASCII transmission modes, supported function codes with request/response examples, diagnostics sub-functions and exception codes.
Dotyczy: adapter sieciowy CREVIS NA-9473 (MODBUS RTU/ASCII, RS-485) systemu FnIO z modułami rozszerzeń serii ST
Źródło: dokumentacja producenta (CREVIS NA-9473 MODBUS Adapter (RS-485) User Manual); tabele przepisane z obrazów na tekst – opracowanie Multiprojekt
Rozdział 6 „MODBUS Interface” podzielono na 2 strony: Transmission Modes and Function Codes · Special Registers.
6.1.1 MODBUS Transmission Mode
Two different serial transmission modes are defined: The RTU mode and the ASCII mode. It defines the bit contents of message fields transmitted serially on the line. It determines how information is packed into the message fields and decoded.
6.1.1.1 RTU Transmission Mode
When devices communicate on a MODBUS serial line using the RTU (Remote Terminal Unit) mode, each 8–bit byte in a message contains two 4–bit hexadecimal characters. The main advantage of this mode is that its greater character density allows better data throughput than ASCII mode for the same baud rate. Each message must be transmitted in a continuous stream of characters.
RTU message frame
| Start | Address | Function | Data | CRC Check | End |
|---|---|---|---|---|---|
| ≥ 3.5 chars | 1 char | 1 char | Up to 252 chars | 2 chars | ≥ 3.5 chars |
6.1.2.2 ASCII Transmission Mode
When devices are setup to communicate on a MODBUS serial line using ASCII (American Standard Code for Information Interchange) mode, each 8–bit byte in a message is sent as two ASCII characters. This mode is used when the physical communication link or the capabilities of the device does not allow the conformance with RTU mode requirement regarding timers management.
ASCII message frame
| Start | Address | Function | Data | CRC Check | End |
|---|---|---|---|---|---|
| 1 char | 2 chars | 2 chars | Up to 252 chars | 2 chars | 2 chars CR,LF |
6.2.2 Supported MODBUS Function Codes
Supported MODBUS function codes
| Function
| Function | Description | Unicast / Broadcast |
|---|---|---|---|
| 1 (0x01) | Read Coils | Read output bit | Unicast |
| 2 (0x02) | Read Discrete Inputs | Read input bit | Unicast |
| 3 (0x03) | Read Holding Registers | Read output word | Unicast |
| 4 (0x04) | Read Input Registers | Read input word | Unicast |
| 5 (0x05) | Write Single Coil | Write one bit output | Unicast / Broadcast |
| 6 (0x06) | Write Single Register | Write one word output | Unicast / Broadcast |
| 8 (0x08) | Diagnostics (Serial Line only) | Read diagnostic register | Unicast |
| 15 (0x0F) | Write Multiple Coils | Write a number of output bits | Unicast / Broadcast |
| 16 (0x10) | Write Multiple registers | Write a number of output words | Unicast / Broadcast |
| 23 (0x17) | Read / Write Multiple register | Read a number of input words / write a number of output words | Unicast |
6.2.1 Read Coils
(0x01)
This function code is used to read from 1 to 2000 contiguous status of coils in a remote device. The Request PDU specifies the starting address, i.e. the address of the first coil specified, and the number of coils. In the PDU Coils are addressed starting at zero. Therefore coils numbered 1-16 are addressed as 0-15. The coils in the response message are packed as one coil per bit of the data field. Status is indicated as 1= ON and 0= OFF.
Request
Response
Read Coils (0x01) – request example
| Field name | Example | RTU |
|---|---|---|
| Start of Frame | - | t1-t2-t3 |
| Slave Address | 0x07 | 0x07 |
| Function Code | 0x01 | 0x01 |
| Starting Address Hi | 0x10 | 0x10 |
| Starting Address Lo | 0x00 | 0x00 |
| Quantity of Outputs Hi | 0x00 | 0x00 |
| Quantity of Outputs Lo | 0x0A | 0x0A |
| Error Check (CRC/LRC) | - | 0xB8, 0xAB |
| End of Frame | - | t1-t2-t3 |
Response
Read Coils (0x01) – response example
| Field name | Example | RTU |
|---|---|---|
| Start of Frame | - | t1-t2-t3 |
| Slave Address | 0x07 | 0x07 |
| Function Code | 0x01 | 0x01 |
| Byte Count | 0x02 | 0x02 |
| Output Status | 0x55 | 0x55 |
| Output Status | 0x02 | 0x02 |
| Error Check (CRC/LRC) | - | 0x8F, 0x6D |
| End of Frame | - | t1-t2-t3 |
* In case of address 0x1015~0x1000 output bit value: 00000010_01010101.
6.2.2. 2 (0x02) Read Discrete Inputs
(0x02)
This function code is used to read from 1 to 2000 contiguous status of discrete inputs in a remote device. The Request PDU specifies the starting address, i.e. the address of the first input specified, and the number of inputs. In the PDU Discrete Inputs are addressed starting at zero. Therefore Discrete inputs numbered 1-16 are addressed as 0-15. The discrete inputs in the response message are packed as one input per bit of the data field. Status is indicated as 1= ON; 0= OFF.
Request
Response
Read Discrete Inputs (0x02) – request example
| Field name | Example | RTU |
|---|---|---|
| Start of Frame | - | t1-t2-t3 |
| Slave Address | 0x07 | 0x07 |
| Function Code | 0x02 | 0x02 |
| Starting Address Hi | 0x00 | 0x00 |
| Starting Address Lo | 0x00 | 0x00 |
| Quantity of Inputs Hi | 0x00 | 0x00 |
| Quantity of Inputs Lo | 0x0A | 0x0A |
| Error Check (CRC/LRC) | - | 0xF8, 0x6B |
| End of Frame | - | t1-t2-t3 |
Response
Read Discrete Inputs (0x02) – response example
| Field name | Example | RTU |
|---|---|---|
| Start of Frame | - | t1-t2-t3 |
| Slave Address | 0x07 | 0x07 |
| Function Code | 0x02 | 0x02 |
| Byte Count | 0x02 | 0x02 |
| Input Status | 0x80 | 0x80 |
| Input Status | 0x00 | 0x00 |
| Error Check (CRC/LRC) | - | 0x50, 0x78 |
| End of Frame | - | t1-t2-t3 |
* In case of address 0x0015~0x0000 output bit value: 00000000_10000000.
6.2.3. 3 (0x03) Read Holding Registers
(0x03)
This function code is used to read the contents of a contiguous block of holding registers in a remote device. The Request PDU specifies the starting register address and the number of registers.
The register data in the response message are packed as two bytes per register, with the binary contents right justified within each byte. For each register, the first byte contains the high order bits and the second contains the low order bits.
Request
Response
Read Holding Registers (0x03) – request example
| Field name | Example | RTU |
|---|---|---|
| Start of Frame | - | t1-t2-t3 |
| Slave Address | 0x07 | 0x07 |
| Function Code | 0x03 | 0x03 |
| Starting Address Hi | 0x08 | 0x08 |
| Starting Address Lo | 0x00 | 0x00 |
| Quantity of Register Hi | 0x00 | 0x00 |
| Quantity of Register Lo | 0x02 | 0x02 |
| Error Check (CRC/LRC) | - | 0xC6, 0x0D |
| End of Frame | - | t1-t2-t3 |
Response
Read Holding Registers (0x03) – response example
| Field name | Example | RTU |
|---|---|---|
| Start of Frame | - | t1-t2-t3 |
| Slave Address | 0x07 | 0x07 |
| Function Code | 0x03 | 0x03 |
| Byte Count | 0x04 | 0x04 |
| Output Register #0 Hi | 0x11 | 0x11 |
| Output Register #0 Lo | 0x22 | 0x22 |
| Output Register #1 Hi | 0x33 | 0x33 |
| Output Register #1 Lo | 0x44 | 0x44 |
| Error Check (CRC/LRC) | - | 0x2D, 0xC6 |
| End of Frame | - | t1-t2-t3 |
* In case of address 0x0800, 0x0801 output register value: 0x1122, 0x3344.
6.2.4. 4 (0x04) Read Input Registers
(0x04)
This function code is used to read from 1 to approx. 125 contiguous input registers in a remote device. The Request PDU specifies the starting register address and the number of registers. The register data in the response message are packed as two bytes per register, with the binary contents right justified within each byte. For each register, the first byte contains the high order bits and the second contains the low order bits.
Request
Response
Read Input Registers (0x04) – request example
| Field name | Example | RTU |
|---|---|---|
| Start of Frame | - | t1-t2-t3 |
| Slave Address | 0x07 | 0x07 |
| Function Code | 0x04 | 0x04 |
| Starting Address Hi | 0x00 | 0x00 |
| Starting Address Lo | 0x00 | 0x00 |
| Quantity of Register Hi | 0x00 | 0x00 |
| Quantity of Register Lo | 0x02 | 0x02 |
| Error Check (CRC/LRC) | - | 0x71, 0xAD |
| End of Frame | - | t1-t2-t3 |
Response
Read Input Registers (0x04) – response example
| Field name | Example | RTU |
|---|---|---|
| Start of Frame | - | t1-t2-t3 |
| Slave Address | 0x07 | 0x07 |
| Function Code | 0x04 | 0x04 |
| Byte Count | 0x04 | 0x04 |
| Input Register #0 Hi | 0x00 | 0x00 |
| Input Register #0 Lo | 0x80 | 0x80 |
| Input Register #1 Hi | 0x00 | 0x00 |
| Input Register #1 Lo | 0x00 | 0x00 |
| Error Check (CRC/LRC) | - | 0x9C, 0x6C |
| End of Frame | - | t1-t2-t3 |
* In case of address 0x0000, 0x0001 input register value: 0x0080, 0x0000.
6.2.5. 5 (0x05) Write Single Coil
(0x05)
This function code is used to write a single output to either ON or OFF in a remote device. The requested ON/OFF state is specified by a constant in the request data field. A value of FF 00 hex requests the output to be ON. A value of 00 00 requests it to be OFF. All other values are illegal and will not affect the output.
Request
Response
Write Single Coil (0x05) – request example
| Field name | Example | RTU |
|---|---|---|
| Start of Frame | - | t1-t2-t3 |
| Slave Address | 0x07 | 0x07 |
| Function Code | 0x05 | 0x05 |
| Starting Address Hi | 0x10 | 0x10 |
| Starting Address Lo | 0x01 | 0x01 |
| Quantity of Outputs Hi | 0xFF | 0xFF |
| Quantity of Outputs Lo | 0x00 | 0x00 |
| Error Check (CRC/LRC) | - | 0xD9, 0x5C |
| End of Frame | - | t1-t2-t3 |
Response
Write Single Coil (0x05) – response example
| Field name | Example | RTU |
|---|---|---|
| Start of Frame | - | t1-t2-t3 |
| Slave Address | 0x07 | 0x07 |
| Function Code | 0x05 | 0x05 |
| Output Address Hi | 0x10 | 0x10 |
| Output Address Lo | 0x01 | 0x01 |
| Output Value Hi | 0xFF | 0xFF |
| Output Value Lo | 0x00 | 0x00 |
| Error Check (CRC/LRC) | - | 0xD9, 0x5C |
| End of Frame | - | t1-t2-t3 |
* Output bit of address 0x1001 turns ON.
6.2.6. 6 (0x06) Write Single Register
(0x06)
Request
Response
Write Single Register (0x06) – request example
| Field name | Example | RTU |
|---|---|---|
| Start of Frame | - | t1-t2-t3 |
| Slave Address | 0x07 | 0x07 |
| Function Code | 0x06 | 0x06 |
| Starting Address Hi | 0x08 | 0x08 |
| Starting Address Lo | 0x00 | 0x00 |
| Quantity of Outputs Hi | 0x11 | 0x11 |
| Quantity of Outputs Lo | 0x22 | 0x22 |
| Error Check (CRC/LRC) | - | 0x07, 0x85 |
| End of Frame | - | t1-t2-t3 |
Response
Write Single Register (0x06) – response example
| Field name | Example | RTU |
|---|---|---|
| Start of Frame | - | t1-t2-t3 |
| Slave Address | 0x07 | 0x07 |
| Function Code | 0x06 | 0x06 |
| Output Address Hi | 0x08 | 0x08 |
| Output Address Lo | 0x00 | 0x00 |
| Output Value Hi | 0x11 | 0x11 |
| Output Value Lo | 0x22 | 0x22 |
| Error Check (CRC/LRC) | - | 0x07, 0x85 |
| End of Frame | - | t1-t2-t3 |
* In case of address 0x0800 output register value: 0x0000 changes to 0x1122.
6.2.7.7 8Diagnostics (0x08)
MODBUS function code 08 provides a series of tests for checking the communication system between a client (Master) device and a server (Slave), or for checking various internal error conditions within a server. The function uses a two–byte sub-function code field in the query to define the type of test to be performed. The server echoes both the function code and sub-function code in a normal response. Some of the diagnostics cause data to be returned from the remote device in the data field of a normal response.
Request
Diagnostics Request
(0x08), sub-function 0x0000 – request example
| Field name | Example | RTU |
|---|---|---|
| Start of Frame | - | t1-t2-t3 |
| Slave Address | 0x07 | 0x07 |
| Function Code | 0x08 | 0x08 |
| Sub-Function Hi | 0x00 | 0x00 |
| Sub-Function Lo | 0x00 | 0x00 |
| Data Hi | 0x11 | 0x11 |
| Data Lo | 0x22 | 0x22 |
| Error Check (CRC/LRC) | - | 0x6C, 0x24 |
| End of Frame | - | t1-t2-t3 |
Response
Diagnostics (0x08), sub-function 0x0000 – response example
| Field name | Example | RTU |
|---|---|---|
| Start
| - | t1-t2-t3 |
| Slave Address | 0x07 | 0x07 |
| Function
| 0x08 | 0x08 |
| Sub-Function Hi | 0x00 | 0x00 |
| Sub-Function Lo | 0x00 | 0x00 |
| Data Hi | 0x11 | 0x11 |
| Data Lo | 0x22 | 0x22 |
| Error Check (CRC/LRC) | - | 0x6C, 0x24 |
| End of Frame | - | t1-t2-t3 |
- Sub-function 0x0000(0) Return Query Data
The data passed in the request data field is to be returned (looped back) in the response. The entire response message should be identical to the request.
| Sub-function | Data Field (Request) | Data
| Description |
|---|---|---|---|
| 0x0000 (0) | Any | Echo Request Data |
- Sub-function 0x0001(1) Restart Communications Option
The remote device could be initialized and restarted, and all of its communications event counters are cleared. Especially, data field 0x55AA makes the remote device to restart with factory default setup of EEPROM
| Sub-function | Data
| Data Field (Response) | Description |
|---|---|---|---|
| 0x0001 (1) | 0x0000, 0xFF00 | Echo Request Data | Reset |
| 0x0001 (1) | 0x55AA | Echo Request Data | Reset with Factory Default* |
- Sub-function 0x000A(10) Clear Counters and Diagnostic Register
The goal is to clear all counters and the diagnostic register. Counters are also cleared upon power–up.
| Sub-function | Data
| Data Field (Response) | Description |
|---|---|---|---|
| 0x000A (10) | 0x0000 | Echo Request Data |
- Sub-function 0x000B(11) Return Bus Message Count
The response data field returns the quantity of messages that the remote device has detected on the
communications system since its last restart, clear counters operation, or power–up
| Sub-function | Data Field (Request) | Data
| Description |
|---|---|---|---|
| 0x000B (11) | 0x0000 | Total Message Count |
- Sub-function 0x000C(12) Return Bus Communication Error Count
The response data field returns the quantity of CRC errors encountered by the remote device since its last restart, clear counters operation, or power–up.
| Sub-function | Data Field (Request) | Data
| Description |
|---|---|---|---|
| 0x000C (12) | 0x0000 | CRC Error Count |
- Sub-function 0x000D(13) Return Bus Exception Error Count
The response data field returns the quantity of MODBUS exception responses returned by the remote device since its last restart, clear counters operation, or power–up.
Exception responses are described and listed in section 6.2.11.
| Sub-function | Data
| Data Field (Response) | Description |
|---|---|---|---|
| 0x000D (13) | 0x0000 | Exception Error Count |
- Sub-function 0x000E(14) Return Slave Message Count
The response data field returns the quantity of messages addressed to the remote device, or broadcast, that the remote device has processed since its last restart, clear counters operation, or power–up.
| Sub-function | Data
| Data Field (Response) | Description |
|---|---|---|---|
| 0x000E (14) | 0x0000 | Slave Message Count |
- Sub-function 0x000F(15) Return Slave No Response Count
The response data field returns the quantity of messages addressed to the remote device for which it has returned no response (neither a normal response nor an exception response), since its last restart, clear counters operation, or power–up.
| Sub-function | Data Field (Request) | Data
| Description |
|---|---|---|---|
| 0x000F (15) | 0x0000 | Slave No Response Count |
- Sub-function 0x0064(100) Return Slave MODBUS, FnBus Status
The response data field returns the status of MODBUS and FnBus addressed to the remote device. This status values are identical with status 1word of input process image. Refer to 5.3.1.
| Sub-function | Data
| Data Field (Response) | Description |
|---|---|---|---|
| 0x0064 (100) | 0x0000 | MODBUS, FnBus Status | Same as status 1 word |
- Sub-function 0x0065(101) Return Slave MODBUS, Error Count
The response data field returns the quantity of watchdog error addressed to the remote device since its last restart, clear counters operation, or power–up.
| Sub-function | Data
| Data Field (Response) | Description |
|---|---|---|---|
| 0x0065 (101) | 0x0000 | Watchdog Error Count |
- Sub-function 0x0066(102) Change Slave IO Output Status
The sub-function with data fields is to clear watchdog counter and change IO output status. This may be used to simulate clear output and fault output.
| Sub-function | Data Field (Request) | Data Field (Response) | Description |
|---|---|---|---|
| 0x0066 (102) | 0x0000 | Echo Request Data | Ready output, automatically turns normal output |
| 0x0066 (102) | 0x0001, 0x0002, 0x0003 | Echo Request Data | Clear output |
| 0x0066 (102) | 0x0004 | Echo Request Data | Normal output |
| 0x0066 (102) | 0x0005, 0x0006, 0x0007 | Echo Request Data | Fault output |
6.2.8. 15 (0x0F)8 Write Multiple Coils
(0x0F)
This function code is used to force each coil in a sequence of coils to either ON or OFF in a remote device. The Request PDU specifies the coil references to be forced. Coils are addressed starting at zero. A logical '1' in a bit position of the field requests the corresponding output to be ON. A logical '0' requests it to be OFF.
The normal response returns the function code, starting address, and quantity of coils forced.
Request
Response
Write Multiple Coils (0x0F) – request example
| Field name | Example | RTU |
|---|---|---|
| Start of Frame | - | t1-t2-t3 |
| Slave Address | 0x07 | 0x07 |
| Function Code | 0x0F | 0x0F |
| Starting Address Hi | 0x10 | 0x10 |
| Starting Address Lo | 0x00 | 0x00 |
| Quantity of Outputs Hi | 0x00 | 0x00 |
| Quantity of Outputs Lo | 0x0A | 0x0A |
| Byte Count | 0x02 | 0x02 |
| Output Value #0 | 0x55 | 0x55 |
| Output Value #1 | 0x01 | 0x01 |
| Error Check (CRC/LRC) | - | 0x21, 0xC9 |
| End of Frame | - | t1-t2-t3 |
Response
Write Multiple Coils (0x0F) – response example
| Field name | Example | RTU |
|---|---|---|
| Start of Frame | - | t1-t2-t3 |
| Slave Address | 0x07 | 0x07 |
| Function Code | 0x0F | 0x0F |
| Starting Address Hi | 0x10 | 0x10 |
| Starting Address Lo | 0x00 | 0x00 |
| Quantity of Outputs Hi | 0x00 | 0x00 |
| Quantity of Outputs Lo | 0x0A | 0x0A |
| Error Check (CRC/LRC) | - | 0xD1, 0x6A |
| End of Frame | - | t1-t2-t3 |
* In case of address 0x1015~0x1000 output bit value: 00000000_00000000 changes to 00000001_01010101.
6.2.9. 16 (0x10)9 Write Multiple Registers
(0x10)
This function code is used to write a block of contiguous registers (1 to approx. 120 registers) in a remote device. The requested written values are specified in the request data field. Data is packed as two bytes per register. The normal response returns the function code, starting address, and quantity of registers written.
Request
Write Multiple Registers (0x10) – request example
| Field name | Example | RTU |
|---|---|---|
| Start of Frame | - | t1-t2-t3 |
| Slave Address | 0x07 | 0x07 |
| Function Code | 0x10 | 0x10 |
| Starting Address Hi | 0x08 | 0x08 |
| Starting Address Lo | 0x00 | 0x00 |
| Quantity of Registers Hi | 0x00 | 0x00 |
| Quantity of Registers Lo | 0x02 | 0x02 |
| Byte Count | 0x04 | 0x04 |
| Register Value #0 Hi | 0x11 | 0x11 |
| Register Value #0 Lo | 0x22 | 0x22 |
| Register Value #1 Hi | 0x33 | 0x33 |
| Register Value #1 Lo | 0x44 | 0x44 |
| Error Check (CRC/LRC) | - | 0x3B, 0x12 |
| End of Frame | - | t1-t2-t3 |
Response
Write Multiple Registers (0x10) – response example
| Field name | Example | RTU |
|---|---|---|
| Start of Frame | - | t1-t2-t3 |
| Slave Address | 0x07 | 0x07 |
| Function Code | 0x10 | 0x10 |
| Starting Address Hi | 0x08 | 0x08 |
| Starting Address Lo | 0x00 | 0x00 |
| Quantity of Outputs Hi | 0x00 | 0x00 |
| Quantity of Outputs Lo | 0x02 | 0x02 |
| Error Check (CRC/LRC) | - | 0x43, 0xCE |
| End of Frame | - | t1-t2-t3 |
* In case of address 0x0800, 0x0801 output register value: 0x0000, 0x0000 changes to 0x1122, 0x3344.
Uwaga Request
Multiprojekt: w oryginale w polu Function Code omyłkowo podano 0x0F; poprawiono na 0x10 – podane sumy CRC (0x3B, 0x12 i 0x43, 0xCE) zgadzają się tylko z kodem 0x10.
Response
6.2.10. 23 (0x17)10 Read/Write Multiple Registers
(0x17)
This function code performs a combination of one read operation and one write operation in a single MODBUS transaction. The write operation is performed before the read. The request specifies the starting address and number of holding registers to be read as well as the starting address, number of holding registers, and the data to be written. The byte count specifies the number of bytes to follow in the write data field. The normal response contains the data from the group of registers that were read. The byte count field specifies the quantity of bytes to follow in the read data field.
Request
Response
Read/Write Multiple Registers (0x17) – request example
| Field name | Example | RTU |
|---|---|---|
| Start of Frame | - | t1-t2-t3 |
| Slave Address | 0x07 | 0x07 |
| Function Code | 0x17 | 0x17 |
| Read Starting Address Hi | 0x08 | 0x08 |
| Read Starting Address Lo | 0x00 | 0x00 |
| Quantity of Read Hi | 0x00 | 0x00 |
| Quantity of Read Lo | 0x02 | 0x02 |
| Write Starting Address Hi | 0x08 | 0x08 |
| Write Starting Address Lo | 0x00 | 0x00 |
| Quantity of Write Hi | 0x00 | 0x00 |
| Quantity of Write Lo | 0x02 | 0x02 |
| Byte Count | 0x04 | 0x04 |
| Write Reg. Value #0 Hi | 0x11 | 0x11 |
| Write Reg. Value #0 Lo | 0x22 | 0x22 |
| Write Reg. Value #1 Hi | 0x33 | 0x33 |
| Write Reg. Value #1 Lo | 0x44 | 0x44 |
| Error Check (CRC/LRC) | - | 0x88, 0x3F |
| End of Frame | - | t1-t2-t3 |
Response
Read/Write Multiple Registers (0x17) – response example
| Field name | Example | RTU |
|---|---|---|
| Start of Frame | - | t1-t2-t3 |
| Slave Address | 0x07 | 0x07 |
| Function Code | 0x17 | 0x17 |
| Byte Count | 0x04 | 0x04 |
| Write Reg. Value #0 Hi | 0x11 | 0x11 |
| Write Reg. Value #0 Lo | 0x22 | 0x22 |
| Write Reg. Value #1 Hi | 0x33 | 0x33 |
| Write Reg. Value #1 Lo | 0x44 | 0x44 |
| Error Check (CRC/LRC) | - | 0x2E, 0xD2 |
| End of Frame | - | t1-t2-t3 |
* In case of address 0x0800, 0x0801 output register value: 0x0000, 0x0000 changes to 0x1122, 0x3344.
6.2.11.11 Error Response
In an exception response, the server sets the MSB of the function code to 1. This makes the function code value in an exception response exactly 80 hexadecimal higher than the value would be for a normal response.
Exception Response Example
Exception response example
| Field name | Example | RTU |
|---|---|---|
| Start of
| - | t1-t2-t3 |
| Slave Address | 0x07 | 0x07 |
| Function Code | 0x81 | 0x81 |
| Exception Code | 0x02 | 0x02 |
| Error Check (CRC/LRC) | - | 0x22, 0xC0 |
| End of Frame | - | t1-t2-t3 |
Exception Codes
6.3. MODBUS Specialexception Registercodes
| Exception Code | Name | Description |
|---|---|---|
| 01 | Illegal Function | The |
| 02 | Illegal Data Address | The data address received in the query is not an allowable address for the server (or slave). |
| 03 | Illegal Data Value | A value contained in the query data field is not an allowable value for server (or slave). |
| 04 | Slave Device Failure | An unrecoverable error occurred while the server (or slave) was attempting to perform the requested action. |
| 05 | Acknowledge | The server (or slave) has accepted the request and |
| 06 | Slave Device Busy | Specialized use in conjunction with programming commands. The server (or slave) is engaged in processing a long-duration program command. The client (or master) should retransmit the |
| 08 | Memory Parity Error | The server (or slave) attempted to read record file, but detected a parity error in the memory. The client (or master) can retry the request, but service may be |
| 0A | Gateway | Specialized conjunction with gateways, indicates
|
* value,NA-9473 thenresponds thewith slaveexception adaptercodes forces01, that02, slot03, output value is automatically set to user-configured fault actions04 and values.
06.
Słowa kluczowe
MODBUS
6.3.3. Adapter Information Special Register (0x1100, 4352)
6.3.4. Expansion Slot Information Special Register (0x2000, 8192)Each expansion slot has 0x20(32) address offset and same information structure.Slot#1 0x2000(8192) ~0x201F (8223)Slot#2 0x2020(8224) ~0x203F (8255)Slot#3 0x2040(8256) ~0x205F (8287)Slot#4 0x2060(8288) ~0x207F (8319)Slot#5 0x2080(8320) ~0x209F (8351)Slot#6 0x20A0 (8352) ~0x20BF (8383)Slot#7 0x20C0 (8384) ~0x20DF (8415)Slot#8 0x20E0 (8416) ~0x20FF (8447)Slot#9 0x2100(8448) ~0x211F (8479)Slot#10 0x2120(8480) ~0x213F (8511)Slot#11 0x2140(8512) ~0x215F (8543)Slot#12 0x2160(8544) ~0x217F (8575)
IO Data Code Format (1 word)
Input/output Data Type:0 0: No I/O Data0 1: Byte Data1 0: Word Data1 1: Bit DataInput/output Data Length:0 0 0 0 0 0 0: 0 Bit/Byte/Word0 0 0 0 0 0 1: 1 Bit/Byte/Word0 0 0 0 0 1 0: 2 Bit/Byte/Word0 0 0 0 0 1 1: 3 Bit/Byte/Word……1 1 1 1 1 1 1: 63 Bit/Byte/Word
6.4.RTU, MODBUS ReferenceMODBUSASCII, Referenceramka, Documentshttp://www.modbus.orgkody funkcji, Read Coils, Read Discrete Inputs, Read Holding Registers, Read Input Registers, Write Single Coil, Write Multiple Registers, diagnostyka, kody wyjątków, CRC
MODBUS Toolshttp://www.modbustools.com , MODBUS pollhttp://www.win-tech.com , MODSCAN32








































