- 27 -
5. Example 2: Obtaining a Signed Integer Measurement from a DC Voltmeter
This example uses a Modbus command to read the currently displayed signed
integer value from an LWIFI equipped DC voltmeter. The TCP configuration of
QModMaster is the same as for the previous example. In this case, the instrument is
displaying -199.86. The screen capture below shows the main window of
QModMaster which is setup to read the displayed integer value.
The critical items are:
•
Modbus Mode =
TCP
•
Function Code =
Read Holding Registers (0x03)
•
Start Address =
7400
(Dec)
•
Number of Registers =
2
•
Data Format =
Hex
The
Read/Write
icon has been clicked and the values of holding registers 7400 and
7401 are displayed.
The QModMaster Bus Monitor window below presents the Modbus Command trans-
mitted to the LWIFI and its response. Note that the hexadecimal byte values of
B1 EE FF FF
represent the 32-
bit signed two’s complement display value. The four
bytes are combined as
FFFFB1EE
to form the 32-bit value which is -19986 decimal.
A condensed des
cription of two’s complement is available on Wikipedia.
Содержание LWFIX
Страница 10: ...10...
Страница 28: ...28...
Страница 30: ...30 The diagram below describes how each of the bits is interpreted...
Страница 31: ...31 You may wish to use the Windows calculator to convert two s complement values to decimal and vice versa...