User Tools

Site Tools

한국어

moacon:about_modbus:index

About MODBUS

Modbus is a protocol created by Modicon in 1979 to communicate with industrial electronic devices, and has proliferated to become the de facto standard in the industry.

Modbus uses a request/reply protocol with a single master device and one or more slave devices. The master sends a request to a single slave, and that slave replies with a response to the master's request. A slave can only respond to requests from the master; it cannot initiate communication on its own.

Each slave has its own, unique address. The master can only communicate with one slave at a time.

These requests and replies are called frames. Modbus supports two frame formats: Remote Terminal Unit (RTU) and American Standard Code for Information Interchange (ASCII). The RTU format encodes each frame in a compact, binary form and uses a Cyclic Redundancy Check (CRC) to verify the integrity of the transmission. The ASCII format encodes each frame as a set of ASCII characters and uses a Longitudinal Redundancy Check (LRC) to verify the integrity of the transmission.

Modubus request frames vary, but typically they contain the following:

1. Slave Address – The address of the slave device the request is intended for 2. Function Code – The function to performed on the slave device (read, write, etc…) 3. Data – Information needed to perform the given function 4. Error Code – CRC for RTU, or LRC for ASCII to verify the transmission integrity

Modbus reply frames also vary, but typically they contain the following:

1. Slave Address – The address of slave device the reply is from 2. Function Code – The function performed by the slave device 3. Data – Information about the function performed 4. Error Code – CRC for RTU, or LRC for ASCII to verify the transmission integrity

This very brief introduction to Modbus is all that is needed to understand the information to follow. It is out of the scope of this document to explain Modbus in detail so, to learn more, please see The http://www.modbus.org/

The MOACON only supports Modbus RTU.

Modbus RTU Function Codes

The Modbus specification defines a set of function codes that specify how to read and write bits or words (16 bits). Modbus uses the term “coil” to refer to a bit, and “register” to refer to a word.

The MOACON supports the following function codes:

Function Code
(Decimal)
Function Description MOACON Modbus Function
1 Read Coil Status Read 1 or more bits RTU_readCoils
2 Read Input Status Read or more bits RTU_readCoils
3 Read Holding Registers Read 1 or more words RTU_readRegs
4 Read Input Registers Read 1 or more words RTU_readInRegs
5 Force Single Coil Write 1 bit RTU_writeCoil
6 Preset Single Register Write 1 word RTU_writeReg
15 Force Multiple Coils Write multiple bits RTU_writeCoils
16 Preset Multiple Registers Write multiple words

In the MOACON, there is no difference between function codes 1 and 2, and there is no difference between function codes 3 and 4.

moacon/about_modbus/index.txt · Last modified: 2016/04/14 11:07 (external edit)