Modbus Registers

I assume your question is mapping a slave device's variables to a register map.

Technically, yes, you can map whatever you want where ever you want, but you have take into account that for a commercial product, how useable is it?

For discrete/binary values, bit packing is already accomplished with Modbus Function Code 01 (read coils) or FC 02 (read discrete inputs) where, by definition, bits representing the coil status or DI's are packed into a 16 bit register, one coil/input per bit in the reply message.

For 'analog' (non-binary) values I suppose you could pack two 8 bit words into a Holding Register, but you have to realize that for a vast percentage of your customers, that makes it very difficult to use the data, because the data has to be unpacked on the receiving end and lots of masters or their users do not have the wherewithal to unpack the data. Sometimes the master just does not have the bit banging functions to unpack the data or sometimes the users just do not have the skills.

Given the availability of memory nowadays, it seems to me that duplicating data in multiple registers is a viable tactic. For example, you might have coils 0 to 31 also appear as Holding Register 15 and the three critical coils 12, 17 and 31 mapped to Holding Registers 301, 302 and 303.

I also see 'duplicated data' done when analog values are mapped both as integer data (with a fixed multiplier or assumed decimal place) in a one range of registers and as floating point in another range of registers, to accommodate the variety of masters out there.

My suggestion - pack data if you want to, but duplicate the individual values to accommodate your customers who can't handle packed data.
 
Top