Modbus Protocol Specification



tải về 0.61 Mb.
Chế độ xem pdf
trang28/35
Chuyển đổi dữ liệu14.05.2023
Kích0.61 Mb.
#54683
1   ...   24   25   26   27   28   29   30   31   ...   35
modbus protocol

Function Code Field
In a normal response, the slave echoes the function code of the original query in the function
code field of the response. All function codes have a most significant bit (MSB) of 0 (their
values are all below 80 hexadecimal). In an exception response, the slave 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.
With the function code's MSB set, the master's application program can recognize the exception
response and can examine the data field for the exception code.
Data Field
In a normal response, the slave may return data or statistics in the data field (any information
that was requested in the query). In an exception response, the slave returns an exception code
in the data field. This defines the slave condition that caused the exception. Here is an example
of a master query and slave exception response. The field examples are shown in hexadecimal.
http://www.modicon.com/techpubs/excpt7.html (1 of 3) [1/11/2000 10:43:26 PM]


In this example, the master addresses a query to slave device 10 (0A hex). The function code
(01) is for a Read Coil Status operation. It requests the status of the coil at address 1245 (04A1
hex).
Note: Only one coil is to be read, as specified by the number of coils field (0001).
If the coil address is nonexistent in the slave device, the slave will return the exception response
with the exception code shown (02). This specifies an illegal data address for the slave. For
example, if the slave is a 984-385 with 512 coils, this code would be returned.
4.2 Exception Codes
http://www.modicon.com/techpubs/excpt7.html (2 of 3) [1/11/2000 10:43:26 PM]


http://www.modicon.com/techpubs/excpt7.html (3 of 3) [1/11/2000 10:43:26 PM]



tải về 0.61 Mb.

Chia sẻ với bạn bè của bạn:
1   ...   24   25   26   27   28   29   30   31   ...   35




Cơ sở dữ liệu được bảo vệ bởi bản quyền ©hocday.com 2024
được sử dụng cho việc quản lý

    Quê hương