User manual

MODBUS RTU, ASCII, TCP 5
English
1. Description
MODBUS ASCII/RTU is a master-slave communication protocol, able to support up to 247 slaves connected in
a bus or a star network.
The protocol uses a simplex connection on a single line. In this way, the communication messages move on a
single line in two opposite directions.
MODBUS TCP is a variant of the MODBUS family. Specifically, it covers the use of MODBUS messaging in an
“Intranet” or “Internet” environment using the TCP/IP protocol on a fixed port 502.
Master-slave messages can be:
Reading (Function code $01 / $03 / $04)• : the communication is between the master and a single slave.
It allows to read information about the queried counter
Writing (Function code $10)• : the communication is between the master and a single slave. It allows to
change the counter settings
Broadcast (not available for MODBUS TCP)• : the communication is between the master and all the
connected slaves. It is always a write command (Function code $10) and required logical number $00
In a multi-point type connection (MODBUS ASCII/RTU), slave address (called also logical number) allows to
identify each counter during the communication. Each counter is preset with a default slave address (01) and
the user can change it.
In case of MODBUS TCP, slave address is replaced by a single byte, the Unit identifier.
COMMUNICATION FRAME STRUCTURE
ASCII mode
Bit per byte: 1 Start, 7 Bit, Even, 1 Stop (7E1)
Name Length Function
START FRAME 1 char Message start marker. Starts with colon “:” ($3A)
ADDRESS FIELD 2 chars Counter logical number
FUNCTION CODE 2 chars Function code ($01 / $03 / $04 / $10)
DATA FIELD n chars Data + length will be filled depending on the message type
ERROR CHECK 2 chars Error check (LRC)
END FRAME 2 chars Carriage return - line feed (CRLF) pair ($0D & $0A)
RTU mode
Bit per byte: 1 Start, 8 Bit, None, 1 Stop (8N1)
Name Length Function
START FRAME 4 chars idle At least 4 character time of silence (MARK condition)
ADDRESS FIELD 8 bits Counter logical number
FUNCTION CODE 8 bits Function code ($01 / $03 / $04 / $10)
DATA FIELD n x 8 bits Data + length will be filled depending on the message type
ERROR CHECK 16 bits Error check (CRC)
END FRAME 4 chars idle At least 4 character time of silence between frames