This manual applies to Modbus2MBus >=1.4.0
Manual version 2022-01-11
Modbus2MBus translates Modbus telegrams to M-Bus. It supports both ModbusRTU and ModbusTCP meters.
The program supports one multimeter serial RS-485 ModbusRTU serial line and several ModbusTCP meter IP-addresses.
Configuration file: | |
---|---|
XML file that sets up the Modbus registers with Value/Data Information blocks for the virtual M-Bus telegram. This file should be created with Modbus2MBus_Config. If you are using ModbusTCP meters you need to tweak the file a little bit. This will be fixed with a new version of Modbus2MBus_Config. | |
Enable leds: | Enable/disable led functionality. This may overlap other programs in the Pi-900. |
Number of Ports: | |
Number of Modbus ports. The ports are numbered 0,1,... Where only Port0 can be set to RTU. All ports can be set to ModbusTCP (set in xml file). Press save settings to activate. |
Type: | UDP, TCP, Serial. The default settings is UDP 20001 which is the default settings for the MBusHub Masterport. Set to other value if you don't want dataflow through MBusHub. |
---|---|
Localport: | Applies to UDP/TCP. Local portnumber |
ComPort: | RS-232, M-Bus slave, RS-485. Only applicable on Pi-900S, not Pi-900T. Default RS-232. |
Baudrate: | Allowed values 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600. Default 2400. |
Parity: | Parity of serial communication. Default: even parity. |
Stop bit: | Serial Stop bit. |
M-Bus timeout: | Should be longer than the time taking to read all Modbus registers to fill the M-Bus telegram. Should be shorter than the MBusHub master timeout. |
Type: | UDP, TCP, Serial. The default setting is an unconfigured UDP port. Be careful not to use the same port in some other program, for example as an MBusHub slaveport. |
---|---|
Remote IP: | IP-address of Modbus meter. |
Remote Port: | IP Portnumber of Modbus meter. |
ComPort: | RS-232, M-Bus slave, RS-485. Only applicable on Pi-900S, not Pi-900T. Default RS-485. |
Baudrate: | Allowed values 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600. Default 9600. |
Parity: | Parity of serial communication. This may differ between modbus meters on a multimeter RS-485 line and is therefore defined in the XML file individually for each meter. |
Stop bit: | Serial Stop bit. Default 1. |
Modbus timeout: | Timeout for Modbus meters. Default 300ms. |
The error numbers are negative Modbus error numbers except for -257 which is timeout.
Error -1 (81): | Illegal Function Code |
---|---|
Error -2 (82): | Illegal Data Address |
Error -3 (83): | Illegal Data Value |
Error -4 (84): | Server Failure |
Error -5 (85): | Acknowledge |
Error -6 (86): | Server Busy |
Error -10 (8A): | Gateway problem 0A |
Error -11 (8B): | Gateway problem 0B |
Error -257: | Timeout, no response from meter (Modbus2MBus error code) |
The virtual M-Bus meter will respond to Send NKE and Slave Select if the Modbus meter answers to the request. A Modbus error, other than timeout is OK and will lead to an ACK (E5) from the virtual M-Bus meter.
The error behavior for REQ_UD2 has been changed from version 1.04.00.
In earlier versions, a Modbus error results in an M-Bus timmeout.
This has been changed as follows.
Any Modbus error, timeout or other will result in the function bits of the DIB will be set to 3 (error in value). If any error occurs in any Modbus value, the Temporary Error bit will be set in the status value.
This makes the communication more efficient since the user will get all values that were correctly read out from the Modbus meter.
This however has the following consequense. A non exisisting Modbus meter will answer to REQ_UD2 with error on all values. It will not answer to either Send NKE or Slave Select.
Modbus reader is a web utility for making single value readout from a modbus reader. The Modbus reader will most probably use the same modbus port as the Modbus2MBus program. The Modbus2MBus will therefor be stopped during reading of values.
Modbus reader can be used for checking MBusHub-MBus2Modbus conversion but only through a TCP or UDP port, not through a single RS-485 port.
The Modbus Port configuration is the same as for Modbus2MBus Master, see above. If the program returns a timeout, please check if the port is used by some other program, most probably MBusHub. This applies to the RS-485/RS-232 ports.
All values are in decimal, not hex.
Address: | Modbus Meter Address |
---|---|
Register: | The register address of the first register. Notice that this may not stem with the manual. If the manual says register (or sometimes address) 2, test with 2 and 1. If 1 works, it means that the meter is J-Bus, not Modbus, see below. Some meters return error if the register address doesn't match the first register of a value. |
#Registers: | Number of registers to read out. This may be 1 to 125. Some meters return an error value if you try to read something other than a multiple number of registers. |
Function: | The only functions implemented are 03, read input registers and 04, read holding registers. |
RTU/TCP: | Modbus protocol variation. ModbusRTU or ModbusTCP. |
Two and four register values are interpreted as floating point numbers, integers and unsigned integers. Single register values are interpreted as integers and unsigned integers.
There are four different byte orders:
Big endian: | This is the Modbus standard. Most significant byte first and least significant byte last. Opposite to M-Bus wich is strictly Little endian. The byteorder is therefor marked as DCBA. |
---|---|
Little endian: | This is the M-Bus standard. Least significant byte first and most significant byte last. Marked as ABCD. |
Byteswap: | Same as Big endian but the bytes within the register are swapped. Marked as CDAB |
Registerswap: | The registers of a Big endian value are swapped. Marked as BADC. |
Characters: | A semi string value. All non printable values are printed as XXh. All printable values are printed with their character values. |
Request: | Request telegram |
Response: | Response telegram |
Time: | Timestamp of receiving response. |
Below are some valuable tips for configuring and troubleshooting a Modbus meter readout. Notice that for counters, a wrongly configured meter may show correct values until the value is larger than one register.