Part 1
요약·해설
RS485·RS232, FC01·02·03·04·05·06·08·15와 packed coil/discrete-input buffer size를 설명합니다.
One client · many servers
RTU · RS485 · RS232
FCxx · bit-packed
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
0CAEFAA78315A1CCDD3D494E421EE5199DD2C17B499D29B5172B88A251B1C0A3
.. _modbus:
Modbus
######
Modbus is an industrial messaging protocol. The protocol is specified
for different types of networks or buses. Zephyr OS implementation
supports communication over serial line and may be used
with different physical interfaces, like RS485 or RS232.
TCP support is not implemented directly, but there are helper functions
to realize TCP support according to the application's needs.
Modbus communication is based on client/server model.
Only one client may be present on the bus. Client can communicate with several
server devices. Server devices themselves are passive and must not send
requests or unsolicited responses.
Services requested by the client are specified by function codes (FCxx),
and can be found in the specification or documentation of the API below.
Zephyr RTOS implementation supports both client and server roles.
More information about Modbus and Modbus RTU can be found on the website
`MODBUS Protocol Specifications`_.
Samples
*******
* :zephyr:code-sample:`modbus-rtu-server` and :zephyr:code-sample:`modbus-rtu-client` samples give
the possibility to try out RTU server and RTU client implementation with an evaluation board.
* :zephyr:code-sample:`modbus-tcp-server` sample is a simple Modbus TCP server.
* :zephyr:code-sample:`modbus-gateway` sample shows how to build a TCP to serial line
gateway with Zephyr OS.
API Reference
*************
.. doxygengroup:: modbus
.. _`MODBUS Protocol Specifications`: https://www.modbus.org/specs.php
Part 3
한국어 전문 번역
Modbus는 industrial messaging protocol이며 여러 network와 bus용 specification이 있습니다. Zephyr OS 구현은 serial line communication을 지원하고 RS485나 RS232 같은 physical interface에서 사용할 수 있습니다. TCP support를 직접 구현하지는 않지만 application 요구에 맞게 TCP를 구성하는 helper function이 있습니다.
Modbus communication은 client/server model입니다. Bus에는 client가 하나만 있을 수 있고 client 하나가 server device 여러 개와 통신합니다. Server는 passive device이므로 request나 unsolicited response를 스스로 보내면 안 됩니다.
Client가 요청하는 service는 FCxx function code로 지정하며 specification과 아래 API documentation에서 확인할 수 있습니다. Zephyr RTOS는 client와 server role을 모두 지원합니다.
Protocol과 Modbus RTU에 관한 자세한 내용은 MODBUS Protocol Specifications를 참고합니다.
Samples
modbus-rtu-server와modbus-rtu-client: Evaluation board에서 RTU server와 client를 시험합니다.modbus-tcp-server: 단순 Modbus TCP server입니다.modbus-gateway: Zephyr OS로 TCP-to-serial-line gateway를 구성합니다.
API Reference
API는 modbus Doxygen group에 있습니다. Coil과 discrete input은 bit-packed byte array를 사용합니다.
modbus_read_coils()의 FC01 response에서 coil 1은 첫 byte LSB, coil 8은 MSB에 들어갑니다. Buffer size는 최소 (num_coils - 1) / 8 + 1 byte여야 합니다.
MSB LSB
B7 B6 B5 B4 B3 B2 B1 B0
-------------------------------------
coil_tbl[0] #8 #7 #1
coil_tbl[1] #16 #15 #9
:
:
modbus_read_dinputs()의 FC02 discrete input도 같은 bit order이며 buffer size는 최소 (num_di - 1) / 8 + 1 byte입니다.
MSB LSB
B7 B6 B5 B4 B3 B2 B1 B0
-------------------------------------
di_tbl[0] #8 #7 #1
di_tbl[1] #16 #15 #9
:
:
modbus_write_coils()의 FC15 request도 같은 byte·bit layout으로 여러 coil value를 전달합니다. Buffer size는 최소 (num_coils - 1) / 8 + 1 byte입니다.
MSB LSB
B7 B6 B5 B4 B3 B2 B1 B0
-------------------------------------
coil_tbl[0] #8 #7 #1
coil_tbl[1] #16 #15 #9
:
:
API에는 FC03 holding register read, FC04 input register read, FC05 single coil write, FC06 single holding register write와 FC08 diagnostic request도 포함됩니다.
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.