Table of Contents
What is Simple MODBUS?
Simple MODBUS is a protocol created by COMFILE Technology, implementing a simplified subset of the standard Modbus RTU protocol.
The ComfileHMI is the Modbus master; the MCU is the Modbus slave. The master sends a query to the slave, and the slave responds.
Simple MODBUS Function Codes
Simple MODBUS supports the following 6 function codes. A Word is 16-bits.
| Function Code (Base 10) | Description |
|---|---|
| Code 1 - Read Coil | Read Bits |
| Code 3 - Read Registers | Read Words |
| Code 5 - Write Coil | Write Single Bit |
| Code 6 - Write Register | Write Single Word |
| Code 15 -Write Multiple Coils | Write Multiple Bits |
| Code 16 -Write Multiple Registers | Write Multiple Words |
Simple MODBUS Memory and Address Space
Simple MODBUS supports two memory and address spaces: one for coils and one for registers. The memory is allocated in the MCU's memory.
| Memory Space | Number of Bits | Addressing (Base 10) |
|---|---|---|
| Coil | 1-bit | 00001 ~ 09999 |
| Register | 16-bit (1-word) | 40001 ~ 49999 |
Bit addresses range from 00001 through 09999. Address 00000 is invalid. The address put out on the wire will be this address minus 00001 (e.g. Address 00004 will result in a Modbus frame with start address 00004 - 00001 = 00003)
Word addresses range from 40001 through 49999. Address 40000 is invalid. The address put out on the wire will be this address minus 40001 (e.g. Address 40005 will result in a Modbus frame with start address 40005 - 40001 = 00004)
In Simple MODBUS, addresses that begin 1 or 3 are not valid (e.g. 10001, 30001)
Simple MODBUS MCU Program
The following program implements the simple MODBUS protocol on the on the MCU.
