Getting Started With Modbus
This article will help you getting started implementing a Modbus-IDA solution, and to understanding other data sources and sample programs that are available.
The basic MODBUS protocol
MODBUS is a communications protocol originally developed by Modicon in 1979. It is currently managed by the Modbus Organisation. It can seem quite a primitive protocol (i.e. Modbus messages lack basic features such as terminators) but it is very popular within the industrial automation industry, and many Omron devices support it.
A basic MODBUS message consists of a single byte function code, followed by a variable length data segment. The length of the data depends on the function code. The MODBUS protocol includes a basic memory model for devices - each device is seen as consisting of a sequence of coils (boolean flags) and registers (2 byte words). Registers may be either read-only (input registers) or read-write (holding registers). When a device receives a MODBUS message, it is responsible for mapping the MODBUS message to an actual memory location or change in device behaviour. For example, when a device receives a request to write a value of true to coil 1, it may interpret this as a "run" command, whilst a value of false may be interpreted as "stop".
The specification for the base MODBUS protocol is here.
MODBUS serial communications
For RS232 and RS485 MODBUS communications, a wrapper is added to the base protocol. The wrapper consists of
The CRC is a checksum calculated according to a standard mathematical algorithm (CRC-16-IBM).
MODBUS serial communications support 2 transmission modes:
The specification for MODBUS over serial can be found here.
MODBUS over TCP/IP
When used over TCP/IP, a 7 byte header is added to the start of every MODBUS message. This header consists of the following fields:
The specification for MODBUS TCP/IP can be found here.
Links to Samples