Help with Changing ID and Baud on SDM120, EM23 and EM24

Today I have an EM24 and an SDM120 so part of an Openhab system where I can see A, V, W etc.
I want to change ID and Baud as I am currently using 2 Serial for Usb key, and want to assemble this.
SDM120 current: id = 1, baud = 2400, stopBits = "1.0", parity = "none", dataBits = 8, encoding = "rtu"]
Em24 current: id = 2, baud = 9600, stopBits = "1.0", parity = "none", dataBits = 8, encoding = "rtu"
I want
EM24 = id = 1, baud = 9600, stopBits = "1.0", parity = "none", dataBits = 8, encoding = "rtu"
SDM = id = 2, baud = 9600, stopBits = "1.0", parity = "none", dataBits = 8, encoding = "rtu"]
In addition, I have an EM23 that I do not know the connection to yet.
I want
EM23 = id = 3, baud = 9600, stopBits = "1.0", parity = "none", dataBits = 8, encoding = "rtu"
I tried in the program Modbus Poll without success.
So I hope someone can guide me
 

Attachments

You're probably already aware that all devices on a Multidrop RS-485 network need to use the same serial settings, baud rate, parity stop bit, and data word size and each device needs a unique Slave ID.

It appears that these devices do not have a mechanical means of changing the serial settings (DIP switches, jumpers) and that there is no utility program used to access the device and change the serial settings.

So you need to use the existing, hopefully still-in-the-default-state serial settings for each device as you use Modpoll to write the required baud rate and slave ID number to each separate device.

Those devices that use Modbus to configure their own serial comm settings typically do not recognize the changes until the power is cycled to the device. (I say typically because every device with Modbus writes its own rules and frequently those rules are not published). On those devices, it is possible to write one value in one transaction, have it accepted, then successfully write a second value and have it accepted because the serial comm changes have not yet been accepted by the device. The existing serial settings used by both the PC and the device are still valid for both write transactions.

After a power cycle, the revised settings are recognized and PC's settings would have to be changed to match the device's comm settings. If these devices act in that fashion, then you can change one serial comm setting at time without having to change the PC's Modpoll comm settings.

For the SDM you need to change baud rate and slave ID. The top half of your page (for SDM120) tells you that you use Function Code 10 hex (same as Function 16 decimal, I don't remember what Modpoll uses, hex or decimal) to write the correct value to its associated register. Assuming the SDM still has its default settings of Slave ID 1 and baud rate of 2400, then you need to change the PC's/Modpoll's serial comm setting to 2400 baud, no parity, 8 data bits and address slave 1 in the write transaction message. For the other devices, the same thing applies, change the PC/Modpoll serial comm settings to match the device's default settings and address the default slave Id number.

Two tricky things
1. On the SDM, the baud rate and slave ID number registers are floating point format (why didn't the vendor use an integer value coded for each baud rate and a simple integer for the slave ID? Neither ID nor baud rate needs to floating point. Why make life so difficult?) so each value takes 2 Modbus registers for a floating point value. The sheet you provided does not define which of the four IEEE 754 floating point formats the unit uses. If you have to guess, start with Big-Endian with a byte order 3,2,1,0 or 4,3,2,1.

If you attempt to write an integer value, the result will fail.

2. The slave ID (4)0021 and baud rate (4)0029 have 6 registers in-between them; they are not adjacent/contiguous registers. So if you write all 20 bytes in one transaction
(4)0021 slave ID 4 bytes
(4)0023 null data 4 bytes
(4)0025 null data 4 bytes
(4)0027 null data 4 bytes
(4)0029 baud rate 4 bytes
you overwrite 6 registers, (4)0023 through (4)0028 that you don't know what those registers are or do or whether they are even valid registers.
Several things could happen.
Those interim registers might not be valid registers and the slave could throw an exception and reject the whole write-attempt
Those interim registers might be valid registers with valid data of sorts that you've now overwritten with zeros.
Those interim registers might be valid registers that are write-only registers that will trigger an exception.
you might luck out and the intervening registers don't do anything but will take zeros and not affect life.

If it were me, I would attempt to write the meter/slave ID first, in its own transaction, and then attempt to write the new baud rate, rather than write zeros to intermediate, unknown registers. I suspect writing each value in its own transaction will work. If the device accepts the slave ID after the immediate change, before a power cycle, then in order to change the baud rate, you will have to change the PC/Modpoll slave ID address and then write the baud rate value to the SDM device.

Documenting what you've done
If it were me. I'd be keeping notes as I go along the whole process as to what values were written where and what appears to be changed.

The other thing is that I put adhesive labels on anything that doesn't have mechanical serial comm settings because no one remembers what the changes are and once the defaults are changed, it can be a real hassle figuring out which device is which slave number and what the comm settings are.

I don't recall what Modpoll uses for register addressing
(4)xxxx or
Function code + xxxx, or
001C hex indexed addressing

You'll have to figure that out.

EM23 and EM24
Those devices' documentation say that the serial comm settings are Modbus Input Registers because the register addresses start with the numeral (3), for example, (3)04363 and (3)04364.

Modbus defines an input register as a read-only register, meaning that Modbus cannot write to an Input Register. Function code 10 hex or FC16 decimal writes data to (4)xxxx memory, not to (3)xxxx memory, by Modbus Standard definition.

Perhaps the EM23/24 use some other means of establishing the serial comm settings. When there are only two choices, there might be a jumper or a switch somewhere that determines which baud rate is used and some rotary switches that determine the slave ID. Note that switch or jumper changes are usually not recognized until a power cycle is executed.

Zero vs one based addressing

(4)0029 decimal = 001C hexadecimal, where
(4) is a memory area identifier, not part of the Modbus message
0029 is a one-based register address (starts counting from 0001)

001C hex is 0028 decimal, and 001C is a zero based register address, where
(4)0001 = 0000 hex
(4)0002 = 0001 hex
(4)0003 = 0002 hex
(4)0004 = 0003 hex
(4)0029 = 001C hex
On some masters, when the Function Code (FC) is specified, like FC03 read holding registers, the register value used by the master is the digits past the leading numeral (4). Same for FC10 hex or FC16 decimal (write multiple registers to the 4xxxx memory area).
 
Top