JUMO mTRON T Manual page 30

Measuring,control, and automation system
Hide thumbs Also See for mTRON T:
Table of Contents

Advertisement

3 Modbus protocol description
3.6.1
Read n bit
This function is used to read n bits starting from a specific address.
Data request
Slave address
1 byte
Response
Slave address
1 byte
NOTE!
The response always comes in full bytes of 8 bits each. Bit values that are not requested are
filled with the value 0.
Example with the data type bit field 32
The objective is to read out the state of the digital inputs 2 and 3 of a 12-channel digital input/
output module. Its Modbus address here is 5.
According to Chapter 7.3.5 "Modbus addresses for each 12-channel digital input/output mod-
ule", page 111, the word address for this is 0x0002. It contains the values in bits 1 and 2
Hexadecimal calculation of bit address for
Bit address = (0x0002 × 0x10) + 0x1
Hexadecimal calculation of bit address for
Bit address = (0x0002 × 0x10) + 0x2
Since this example involves a bit field 32, you must make sure that the data is in a double word
(32 bit). The start address 0x0002 is the low word. The high word, which is read out first, has
the address 0x0003. As a result, when calculating the correct bit address, the value 10
alternatively the value 16
desired bit value at the right spot in the low word.
You receive 31
of bit 2. A corresponding data request in Modbus format is provided below:
30
Function
0x01 or 0x02
1 byte
Function
0x01 or 0x02
1 byte
bit 1
Result: 21
bit 2
Result: 22
must be added again to the calculated bit address to request the
Dec
or 49
for the bit address of bit 1 and 32
Hex
Dec
Address
Number of bit
of first bit
2 bytes
Number
Bit value(s)
of bytes read
1 byte
Decimal calculation of bit address for bit 1
Bit address = (2 × 16) + 1
Decimal calculation of bit address for bit 2
Bit address = (2 × 16) + 2
Checksum
CRC
2 bytes
2 bytes
Checksum
CRC
x bytes
2 bytes
Result: 33
Result: 34
or 50
for the bit address
Hex
Dec
or
Hex

Advertisement

Table of Contents
loading

Table of Contents