Home Support Technical Papers Modbus Guide

support_team.jpg

MODBUS Guide

This technical paper will answer all your questions on what is MODBUS, how does it work, and where can I find more information.

1/ What is MODBUS?

MODBUS is a commonly used industrial communications protocol which enables the exchange of data between process control equipment and computers or HMIs (Human Machine Interface). It was originally designed for Modicon PLCs (Programmable Logic Controllers) and has become widely used by many process control vendors.

2/ Why would I use MODBUS?

MODBUS is widely used and is a simple protocol, which allows a common means of gathering data to a central location. Typically a PC running a SCADA (Supervisory Control And Data Acquisition) software in one location to gather data from various processes around the factory and setting values in the process control instruments.

3/ How does it work?

Devices using MODBUS communicate using a master-slave arrangement, where only one device (the master) can initiate requests to ether read a value, or write (set) a value. The values are ether analogue (numeric) or digital (on/off). The Master would normally be the PC / HMI running SCADA software which communicates with each of the slave devices.

The slaves respond by supplying the requested data to the master, or by taking the action requested. A request to an individual slave will prompt a reply from that slave back to the master. A broadcast message can be sent to all slaves but no acknowledgement (reply) is received, as all the slaves would transmit at the same time, causing errors.

The Modbus protocol establishes the format for the master's query address, a function code defining the requested action, any data to be sent, and an error-checking field. If the master request is not a broadcast message, the slave's response message is also constructed using the Modbus protocol. It contains fields confirming the action taken, any data to be returned, and an error-checking field. If an error occurred in receipt of the message, or if the slave is unable to perform the requested action, the slave will construct an error message and send it as its response.

4/ Is MODBUS Plus the same as MODBUS?

No, they are different protocols and not compatible.

5/ Is MODBUS TCP/IP the same as MODBUS?

No, they are different protocols and not compatible. A converter from MODBUS serial to MODBUS TCP/IP Ethernet can be used.

6/ Where can I get the protocol Information

See the MODBUS Protocol Guide at: http://www.modbus.org/tech.php

7/ What is a master-slave network?

A master-slave technique is one in which only one device (the master) can initiate queries. The other devices (the slaves) respond by supplying the requested data to the master, or by taking the action requested in the query. There can only be one Master on the network. The slave devices all have unique communications addresses in the range 1-247. Broadcast messages are sent to address 0, which all slaves respond to (hopefully) but do not reply to

8/ How can I connect MODBUS devices together in a network?

To create a network, the devices must use a muti-drop network and each of the slaves must have a unique communication address. Data Track's instruments use a electrically isolated 2-wire RS485 interface. Some of the older instruments can also be used in 4-wire (RS422 / RS485) mode.

9/ What are RS-232, RS-422 and RS-485 and how are they different?

These are standards for serial communications that define the wiring, signal levels, transmission baud rates and parity checking.

  • RS-232 only allows for one master and one slave and is limited to wiring distances of up to 15 meters. It is also more sensitive to errors generated by electrical "noise".
  • RS-422 can address up to 10 slaves using four wires (full duplex) to a maximum wiring distance capacity of 1200 meters.
  • RS-485 can address up to 32 slaves using either a two-wire (half duplex) system or four-wire system (full duplex) to a maximum wiring distance capacity of 1200 meters.

There is no advantage to 4-wire (full duplex) mode when using Modbus as the protocol defines that only one device can transmit at a time.

Do not confuse the electrical standard (e.g. RS485) with the protocol (e.g. Modbus). Protocols define how the data is organised while the electrical standards determine how the data is physically transmitted. There are many different protocols that can be used on serial RS-232, RS-422 and RS-485 wired systems.

10/ How can I have more than 32 slaves on the RS485 network?

There are RS485 repeaters commercially available. A repeater replaces the 32nd device and then another 32 devices can be connected bringing the total to 61 slaves. Further repeater/slaves can be connected however the communication speed should be considered. If the master software allows two serial ports to be used simultaneously then this may be a better method of expanding the network.

11/ How do I change the slave address?

The factory default address is set to 1. On our panel meters, the first parameter in the COM menu is the address number. For the Tracker 300 the communication address is set in the communications menu. See the product manuals for details. Two slaves with the same address will cause errors.

12/ Where do I connect the communication wires?

The manuals show connection details. Manuals are available from the download section on this web site. Use 2-wire mode if possible.

13/ Will I damage something if I get the wires swapped?

The RS-485 interface can withstand swapped wires. All Tracker RS485 interfaces are electrically isolated.

14/ Do I have to turn off the Tracker to connect the wires?

Yes. There may be high voltages present on the other terminals.

15/ How far away can devices be separated from each other?

On RS485 connections, the maximum distance is 1200 meters without repeaters.

16/ What sort of cable should I use?

A shielded #22AWG cable with twisted pairs and foil screen is recommended. The screen should be connected to earth (ground) at the PC/HMI end only.

17/ What are the communication settings?

Our default for Modbus RTU is 9600 baud, 1 stop bit, no Parity (None). Often only the communications address needs to be changed. On our older products you will need to manually change Parity to None and turn the RTU parameter to ON.

18/ What are ASCII and RTU modes?

ASCII was the original Modbus method of transmitting data by the network. Although reliable it is also quite slow compared with RTU mode. RTU is now the most commonly used by far. Use RTU unless you are extending an existing Modbus ASCII system. All Data Track's instruments support Modbus ASCII and Modbus RTU.

19/ What is Floating point Modbus?

Standard Modbus uses 16 bit integer values to be transmitted, which need to be scaled to engineering units by both the Master device and by the slave(s). Floating Point uses two 16-bit values to produce a 32-bit floating-point (real) value, which needs no scaling. This method, although not a standard, is gaining popularity and is available from an ever-increasing number of vendors. All Tracker products that have a RS485 interface support floating point Modbus.

20/ Where is the data held?

Modbus refers to analogue data as inputs and holding registers. Logic variables are referred to as coils for inputs and outputs and discretes for memory On/Off values. Trackers treat both the two analogue types (A0 to Annn) as the same and the two logic types as the same (L0 to Lnnn).

21/ What is a Logic location

This is a single bit of information indicating either an ON (1) or OFF (0) state. They can be real time (e.g. a logic input state or an alarm state) or a configuration parameter (e.g. Alarm latching function On/Off)

22/ What is a register?

This is a 16-bit data field, including temperatures, pressures, times and PID variables. They can be real time (e.g. a temperature) or a configuration parameter (e.g. Alarm setpoint value).

23/ Where do I find information on locating the data that I want?

The manuals list all the available data for analogue and logic locations. Also a communications help document is available in our download section.

24/ Which Modbus functions are supported?

The following Modbus functions are supported by Tracker instrumentation.

Function - Description

1 - Read Coils

2 - Read Discretes

3 - Read Holding Registers

4 - Read Input Registers

5 - Write Single Coil

6 - Write Single Register

15 - Write Multiple Coil

16 - Write Multiple Registers

25/ Can I write a value to the Trackers?

There are both read and write functions but some locations may be read only (e.g. a measured value) or the instrument can be set to write protected mode by the user during configuration.

26/ Can I control the Tracker remotely through MODBUS?

The master device can control the display, analogue and logic outputs and many other functions if the instrument is configured to allow this.