Communication Modbus Protocol: MFD44 NEMO-D4Le
Communication Modbus Protocol: MFD44 NEMO-D4Le
Communication Modbus Protocol: MFD44 NEMO-D4Le
H
COMMUNICATION MODBUS PROTOCOL Fw. Version ≥ 3.205
MFD44 30/03/2016
NEMO-D4Le
Pag. 1/21
CONTENTS
1.0 ABSTRACT ..................................................................................................................................................................................... 2
2.0 DATA MESSAGE DESCRIPTION ............................................................................................................................................. 3
2.1 Parameters description ............................................................................................................................................................. 3
2.2 Data format .................................................................................................................................................................................. 4
2.3 Description of CRC calculation .............................................................................................................................................. 5
2.4 Error management .................................................................................................................................................................... 5
2.5 Timing ........................................................................................................................................................................................... 6
3.0 COMMANDS ................................................................................................................................................................................... 7
4.0 VARIABLES ..................................................................................................................................................................................... 8
5.0 SETUP PARAMETERS ............................................................................................................................................................... 16
COMMUNICATION MODBUS PROTOCOL Pag. 2/21
1.0 ABSTRACT
Physical level
The physical communication line complies with the EIA-RS485 standard in half-duplex modality.
In this case, as only two wires are used, only one instrument at a time can engage the line; this means that there
must be a master which polls the slave instruments so the demand and the request are alternated.
On the same physical line only 32 instruments can be attached (master included). In order to increase the
number of the slave instrument, the necessary repeaters must be used.
The data are transmitted in a packet form (message) and are checked by a word (CRC).
See the description of the data packet in the next paragraphs for more details.
Application level
Error answer
CRC word : it is the result of the calculation done on all the bytes in the message
COMMUNICATION MODBUS PROTOCOL Pag. 4/21
The following types of format are used for the data values :
If the required data is in a DWORD format, 2 WORDS are transmitted and the MSW comes before the LSW
(depending on the setting in the NEMO 96 : big endian / little endian / swap WORDS
Example : 1000 = 0x 03 e8 or
0x 00 00 03 e8 (if UDWORD)
crc16 = (crc16 >> 8) | (crc16 << 8); /* LSB is exchanged with MSB */
return (crc16);
} /* calc_crc */
If the received message is incorrect (CRC16 is wrong) the polled slave doesn’t answer.
If the message is correct but there are errors (wrong functional code or data) it can’t be accepted, so
the slave answers with an error message.
The error codes are defined in the following part of the document.
COMMUNICATION MODBUS PROTOCOL Pag. 6/21
2.5 Timing
MASTER
BYTE 1 BYTE 2
BYTE n RESPONSE
T1
MESSAGE
SLAVE
T2 T3
Be careful : among the setup parameters there is a timeout value that may be programmed.
This is the inter-characters timeout and implicitly is the timeout to detect the end of a message.
The value of 20 msec is suggested to keep compatibility with older IME devices.
The minimum value is 3 msec.
3.0 COMMANDS
Code 0x03 : reading of one or more consecutive WORDS
Command format :
The BYTES number must always match the WORDS number (in the demand) * 2.
Error codes :
* 0x01 : incorrect functional code
* 0x02 : wrong first WORD address
* 0x03 : incorrect data
Command format :
BYTE BYTE MSB LSB MSB LSB BYTE MSB LSB MSB LSB
Funct. First WORD WORDS BYTE
Device address Word Value CRC16
Code address number numbers
The BYTES number must always match the WORDS number (in the demand) * 2.
Error codes :
* 0x01 : incorrect functional code
* 0x02 : wrong first WORD address
* 0x03 : incorrect data
COMMUNICATION MODBUS PROTOCOL Pag. 8/21
4.0 VARIABLES
Variables or groups of variables may be required up to 240 BYTES
(*) wrap around means : when the main register of the energy value increases over
100 000 000 , the register is then reset to 0 and the wrap around value is incremented
by 1
COMMUNICATION MODBUS PROTOCOL Pag. 13/21
(2) ---------------------------------------------------------------------------------
Device programmed in “Alarm Output” mode :
0: No active Alarm
1: Alarm active
(3) ---------------------------------------------------------------------------------
(4) ---------------------------------------------------------------------------------
(6) ---------------------------------------------------------------------------------
0 : positive
1 : negative
COMMUNICATION MODBUS PROTOCOL Pag. 16/21
NEMO D4-Le parameters may be red and written accordingly to the procedure described in the following.
The variable table to read and write the parameters are located at the same address.
It is allowed to write the setup parameters addressed at 0x2000 and 0x2200 only by a single telegram for each group.
Length : 16 BYTES
Length : 24 BYTES
E.g. Request
FF 03 22 00 00 18 5A 66
Answer :
FF 03 30 | 00 00 | 00 00 | 00 00 | 00 00 | 00 00 | 00 00 | 00 00 | 00 00 | 00 00 |
00 00 | 00 00 | 00 00 | 00 00 | 00 00 | 00 00 | 00 00 | 00 00 | 00 00 |
00 00 | 00 00 | 00 00 | 00 00 | 00 01 | 00 02 | 6D C1
Procedure to write
Address 0x2700 : write word with value = 0x5AA5 (Master Unlock Key)
Any writing operation of any parameter will have effect only in the volatile memory (RAM).
After any writing operation of parameters described in the following of the document, if necessary to go back to the default
it is mandatory to send the following commands :
Address 0x2700 : write WORD with value = 0x 5AA5 ( Master Unlock Key )
Address 0x2800 : write WORD with value = 0x YYYY ( any value )
This command will reset the NEMO and in this way all changes will be lost so returning to the previous conditions.
EEPROM savings
If it is necessary to save the new parameters in EEPROM it is mandatory to send these following messages :
Address 0x2700 : write WORD with value = 0x 5AA5 ( Master Unlock Key )
Address 0x2600 : write WORD with value = 0x YYYY ( any value )
COMMUNICATION MODBUS PROTOCOL Pag. 21/21
(12) To reset desired measurements write the following word (in binary) :
0|0|0|0|0|0|0|0|b8|b7|b6|b5|b4|b3|b2|b1|b0
b9 .. b15 = 0
(13) Write any value to save the new parameters changed by Remote commands
(14) To do any remote programming write operation, it’s mandatory to write a safety
key = 0x5AA5.
(15) Write any value to abort any remote programming write operation and reload
the previous values.
(16) The parameters are read and written with the same sequence.