Jamod Modbus Slave - assign registers

870 views Asked by At

i tried the modbus slave program from the jamod library.I can set a input register with:

spi.addInputRegister(new SimpleInputRegister(45));

i can set 3 input registers with:

spi.addInputRegister(new SimpleInputRegister(45));
spi.addInputRegister(new SimpleInputRegister(45));
spi.addInputRegister(new SimpleInputRegister(4563));

This will be the registers 0,1 and 2. How can i set this registers do register address 100,101,102? Do i have to add some fake registers?

greets Andreas

1

There are 1 answers

0
Julie in Austin On BEST ANSWER

You can create "fake" registers by adding registers in a loop. This won't create a hole in the Modbus map, so those "fake" registers will be usable by any masters and they will won't cause ILLEGAL ADDRESS EXCEPTION responses.

I have modified j2mod, which is a fork of jamod, so it supports sparse Modbus maps as of SVN revision 95. j2mod is also available on SourceForge.