====== 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. {{ :comfilehmi:simplemodbus:simplemodbus.png?nolink |}} ===== Simple MODBUS Function Codes ===== Simple MODBUS supports the following 6 function codes. A //Word// is 16-bits. ^Function Code (Base 10) ^Description^ |[[.:Modbus_Code1:|Code 1 - Read Coil]] |Read Bits| |[[.:Modbus_Code3:|Code 3 - Read Registers]] |Read Words| |[[.:Modbus_Code5:|Code 5 - Write Coil]] |Write Single Bit| |[[.:Modbus_Code6:|Code 6 - Write Register]] |Write Single Word| |[[.:Modbus_Code15:|Code 15 -Write Multiple Coils]] |Write Multiple Bits| |[[.:Modbus_Code16:|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. [[.:simpleMODBUS_Source:|Simple MODBUS MCU Source Code and Explanation]] [[comfilehmi:index#ComfileHMI_Connectivity| Back to ComfileHMI]]