UM-0085-B09
DT80 Range User Manual
Page 366
RG
In this case the DT80 will send a Modbus request to read input registers #1-50 to the Modbus slave at address 127.0.0.1.
This address is a special "loopback" IP address, which will actually be received by the DT80 itself. The DT80 Modbus
server will then process the request in the normal way. As indicated in the table in
Accessing DT80 Channels via Modbus
, input registers #1-1000 are mapped onto 1CV-1000CV, so the DT80 will reply to the request with the values of
1CV-50CV. The MODBUS channel will then process the reply and store the values into 101CV-150CV.
Note:
in this example the CV values will be transferred using standard 16-bit Modbus registers, so an appropriate scaling factor should
be applied using the
SETMODBUS
command if the CVs contain non-integer values.
Examples
Some further examples are given below.
•
1MODBUS(AD19,R3:100)
– read input register #100 from device with address 19 connected to serial
sensor port
•
4MODBUS(AD"10.0.0.123",R3:100)
– as above, but read from a device with IP address 10.0.0.123
•
1MODBUS(AD1,R3:100,=10..19CV)
– read input registers #100-119 and save to 10..19CV
•
1MODBUS(AD1,R3:70,MBF)
– read input registers #70 and #71 and interpret as the high and low words
respectively of a 32 bit IEEE-754 floating point value.
•
1MODBUS(AD1,R3:70,MBF,MER)
– as above, except that register #70 contains the low word and
#71contains the high word (i.e. "little endian" format).
•
1MODBUS(AD1,R4:100)=235
– write 235 to holding (output) register #100
•
1MODBUS(AD1,R3:1,0.1)
– read input register #1 and multiply by 0.1 (often used when the register
contains a fixed point value, e.g. it measures in tenths of a degree)
•
1MODBUS(AD1,R3:21,S2)
– read input register #21 and apply scale and offset as specified in span S2.
•
1MODBUS(AD1,R4:100,SR2)=1..3CV
– write 1..3CV values to holding registers #100-102, after
applying span S2 in reverse to each value
•
1MODBUS(AD1,R1:100:8)
– read discrete inputs #100-107 and pack into a single 8-bit value with input
#100 as the least significant bit.
•
1MODBUS(AD1,R0:100:16)=0xFFFF
– set coils #100-115 to 1
•
1MODBUS(AD1,R0:100)=4CV
– set coil #100 to 1 if 4CV is non-zero, 0 if 4CV is zero
•
1MODBUS(AD1,R1:100:16,=1..2CV)
– read discrete inputs #100-115 into 1CV, #116-131 into 2CV
•
1MODBUS(AD1,R3:100,MBF,=1..2CV)
– read input regs #100-101 as a floating point value and save to
1CV, read input regs #102-103 as a second floating point value and save to 2CV.
Troubleshooting
Setting
P56=4
will enable the output of diagnostic messages which allow you to see received and transmitted Modbus
messages as they occur. This is described further in the Modbus slave section,
.
The TCP/IP loopback facility, where you specify the address 127.0.0.1 in order to cause the DT80 to send Modbus
messages to itself, can be a handy way to test your DT80 program without requiring the connection of a real Modbus
sensor. For example, you can simulate a sensor's input registers by setting a range of CVs, then reading them using the
MODBUS
channel – as described in
above.
If the DT80 is unable to communicate with a Modbus sensor, an error message will be reported, such as
1MODBUS(AD5,R3:1)
dataTaker 85 E124 - Modbus transaction failed
1MODBUS NotYetSet
Check the following:
•
Ensure the address specified in the
AD
channel option matches the Modbus device's configured serial or IP
address
•
Ensure that all Modbus devices on the network have unique addresses.
•
If the DT80 has a manually configured IP address and the sensor is not on the same local network segment
then ensure that the DT80's Ethernet gateway is set correctly, using
PROFILE ETHERNET GATEWAY=
ip-
addr
•
Ensure that the device actually supports the register number that you are trying to read. Make sure that you
understand the convention that is used in the device's documentation for specifying register numbers.
•
For serial Modbus, ensure that the serial port is set up correctly, using the appropriate profile settings. This
includes port mode (RS485/ 422/ 232; serial sensor port only), port function (must be set to
MODBUS_MASTER
), baud rate and possibly other settings.
•
For serial Modbus over RS422, ensure that the port is wired correctly with the DT80 as the master.
Содержание DT80
Страница 29: ...UM 0085 B09 DT80 Range User Manual Page 29 RG The DT80 File System P114 ...
Страница 184: ...UM 0085 B09 DT80 Range User Manual Page 184 RG Figure 71 DT80 communications options ...
Страница 185: ...UM 0085 B09 DT80 Range User Manual Page 185 RG Figure 72 DT80 communications options integrated modem models ...