Control Solutions is your source for LonWorks I/O.

What does notation like 40001:7 mean?

This is a commonly used notation for referencing individual bits in a register. This particular example references register 40001, bit 7. Bits are generally numbered starting at bit 0, which is the least significant or right most bit in the field of 16 bits found in a Modbus register.

Do I want register 1 or 40001?

A significant amount of Modbus device documentation uses 40001 to refer to holding register 1. The offset of 40,000 indicates holding register, also sometimes called a "4X" register. This notation is sometimes referred to as "Modicon" convention since Modicon PLCs are where this method was first used and documented. When this form of notation is used, the following offsets are used:

0x Coil 00001-09999
1x Discrete Input 10001-19999
3x Input Register 30001-39999
4x Holding Register 40001-49999

This notation has the limitation of only supporting 9,999 registers of each type. The extended form of the same notation uses an offset of 400,000 to reference a holding register. The entire list of applicable offsets is:

0x Coil 000001-065535
1x Discrete Input 100001-165535
3x Input Register 300001-365535
4x Holding Register 400001-465535

This is only a documentation convention. The offset or register type determines the function code used to access that register. The addresses that go out over the wire start at 0 and run through 65,535 in all cases. Raw address is always one less than register number.

If documentation lists register 40001 you should enter register number 1 and select holding register as the type. Some Control Solutions products do use the notation shown above. Babel Buster SP and the AddMe III family all use register numbers starting at 1 in all cases, along with an indication of register type selected from a list of descriptive names such as "holding register".

How to I read individual bits in a register?

The bit mask shown in the expanded form of the RTU read map is a 4 digit hexadecimal (16 bit) value used to mask out one or more bits in a register. The selected bits will be right justified, so a single bit regardless of where positioned in the source register will be stored locally as 0 or 1. The notation of register number followed by a colon and number from 0 to 15 indicates a single bit picked from that register. The hex bit mask values would be as follows, assuming a register number of 40001.

40001:0 mask: 0001
40001:1 mask: 0002
40001:2 mask: 0004
40001:3 mask: 0008
40001:4 mask: 0010
40001:5 mask: 0020
40001:6 mask: 0040
40001:7 mask: 0080
40001:8 mask: 0100
40001:9 mask: 0200
40001:10 mask: 0400
40001:11 mask: 0800
40001:12 mask: 1000
40001:13 mask: 2000
40001:14 mask: 4000
40001:15 mask: 8000

Sometimes a 16-bit register is used to hold two 8-bit values. To strip bytes using the bit mask, you would enter the following:

Low byte mask: 00FF
High byte mask: FF00

The following example shows reading a single bit documented as 40289:6. After processing this read map, local register 38 will contain either 0 or 1 according to bit 6 in holding register 289 in the device with slave address 1.