
3
CARLO GAVAZZI
CONTROLS
SERIAL COMMUNICATION PROTOCOL
WM4-96
V1 R3
Page
1 SERIAL COMMUNICATION PROTOCOL
1.1 INTRODUCTION
WM4-96 can be equipped with a RS485 or RS232 serial interface. The serial communication
protocol, MODBUS-RTU, is the same on both interfaces. When using RS485, it is possible to
connect up to 255 instruments using MODBUS protocol. When using RS232 it is only possible to
connect a single instrument (multidrop feature is not available).
The command’s structure of the protocol allows the user to read and write from/in the µP RAM
memory and the peripheral devices (EEPROM, real time clock, flash memory), so that all the
functions are completely transparent.
The communication parameters are configurable when using both the RS485 interface and the
RS232 one, in accordance with the following table:
Interface Baud rate (bps) Parity Stop bit
RS232 2400 to 38400 None 1
RS485 1200 to 9600 None, even, odd 1
NOTE: please refer to the instruction manual for any detail on the instrument programming.
The communication can be started only by the HOST unit, which sends the request frame. Each
frame contains the following information:
• slave address: is a number from 1 to 255, which identifies the instrument connected to the
network. Address 0 (zero) is accepted (in write frames only) by all the instruments, which will
execute the relevant command but won’t send any answer frame.
NOTE: The request frame must always contain the address even if, when using RS232, it is not
considered (every legal value is accepted).
• command: it defines the command type (e.g. read function, write function etc.).
• data fields: these numbers define the operating parameters of the command (e.g. the address of
the word, the value of the word to be written, etc.).
• CRC word: it allows detecting transmission errors that may occur. CRC calculation is carried out
by the MASTER unit once it has defined address, command and data fields. When the frame is
received by the SLAVE, it is stored in a temporary buffer. The CRC is calculated and then
compared with the received one. If they correspond and the address is recognised by the SLAVE
unit, the command is executed and an answer frame is sent.
If the CRC is not correct, the frame is discarded and no answer is sent.
1.2 FUNCTIONS
WM4-96 accepts the following three commands:
• Read words (code 04h)
• Write one word (code 06h)
• Read words from Flash Memory (code 80h)
NOTE: the memory addressing is different according to the used function. It is explained in detail in
the paragraph 1.3.
Function 04h and 06h are compatible with the Modbus coding, while function 80h is very similar but
differs slightly from Modbus coding.
Komentáře k této Příručce