X2 Modbus Output


The X2 Modbus Output tool is designed specifically for applications utilizing a Programmable Logic Controller (PLC) with the Modbus communication protocol (RS-232 or RS-485). The connection from the X2 to the PLC will include a NexSens plug cable (UW-FLx) to one of the X2’s sensor ports, along with a variety of other connection options for linkage to the PLC.

Note: The X2 will act as a Modbus Master. 

 

Software & Logger Requirements

  • X2 Base Firmware: v2.20.200922 or higher
  • X2 Base Radio RTU Firmware: v2.31.200920 or higher
  • CONNECT Software: v2.20.5.4 or higher

 

Wiring

Cable ConnectionWire ColorSignal
NexSens UW6-FLx*RedPWR (+12VDC)
BlackGND
NexSens UW8-FLx**GreenRS485A
BlueRS485B
BlackGND (common)

*Connects to center 6-pin power port on the X2 data logger.
**Connects to P0, P1, or P2 port on the X2 data logger. Modbus shared between all three ports.

 

Setup X2 Modbus Output

  1. Connect the X2 logger to a PC and launch the CONNECT software. Test connection by reading the RTC clock of the logger in the CONFIG tab.
  2. Click Setup | X2 Modbus Output.
X2 Modbus Output menu.

Figure 1: X2 Modbus Output configuration menu.

 

  1. Select Read Settings from X2.
    1. Settings must be read before any changes can be made.
Read X2 Modbus Output settings

Figure 2: Confirmation that the X2 Modbus output settings have been read.

 

Modbus Information

  1. The following Modbus settings can be adjusted on the X2:
    1. Check Enable Modbus Output at the top of the interface.
    2. For an X2 radio network, click Single Address to use the same Modbus address for both the X2 base radio and all field radios.
      • See the X2 Radio Network section below for more information.
    3. Insert the Base X2 Address.
      • This address corresponds to the Modbus slave (PLC) address that the X2 will use to output data to the PLC.
    4. Insert the Base Register.
      • This register starts from 0 and corresponds to the Modbus slave (PLC) beginning register that the X2 will output to the PLC.
      • Parameters from the X2 are written to the Modbus slave (PLC) starting from this register.
    5. See the X2 Radio Network section below for information on the RTU Address and RTU Register.
X2 Modbus Output settings.

Figure 3: X2 Modbus settings.

 

Communication Settings

  1. The following Communication settings can be adjusted on the X2:
    1. Connection: Choose the Modbus protocol (RS-485 or RS-232) that the X2 will output, which can be recognized by the PLC.
      •  The X2 sensor port (P0, P1, P2) must be specified for RS-232 since each port contains a separate RS-232 line. Currently, RS-232 is not supported. 
      • RS-485 communication is shared between each sensor port, thus the port where Modbus output will occur does not need to be specified.
    2. Baud: The default baud rate is 19200; however, options range from 9600 to 57600.
    3. Frame: 
      • E81: 8 data bit, 1 stop bit, even parity
      • N81: 8 data bit, 1 stop bit, no parity (default)
      • O81: 8 data bit, 1 stop bit, odd parity
    4. Num Retry: The default is 1 retry; however, the range is from 1 to 254.
      • The X2 utilizes a coarse retry. By default, if the X2 does not get a response from the Modbus slave, it conducts 3 retries each separated by 100 milliseconds (msec). Coarse retries are repeated every second.
      • Example: If the number of retries is set to 2, the X2 will send data to the slave up to 6 times before ending the retry process.
      • Note: Feature not available for the RTU.
    5. Timeout (msec): This feature represents the timeout (msec) the X2 will wait for the Modbus slave to respond.
      • Note: This feature is currently not supported.

Figure 4: X2 to PLC Communication settings.

 

Format Settings

  1. The following Format settings can be adjusted on the X2:
    1. Data Type: 32-bit FLOAT (big endean) is the only data type currently supported.
    2. Mode: Modbus RTU is the only mode currently supported.

Figure 5: Data Format settings.

 

Once all changes have been made, click Save Setting to X2.

 

X2 Radio Network

For a radio network with multiple field radio X2’s, both data from the base radio (directly connected to the PLC) and field radios are set to output in Modbus.

RTU Address and Register

  1. RTU Address: The Modbus slave (PLC) address offset for each field radio X2.
    • See example below in the Single Address Unchecked section.
  2. RTU Register: The Modbus slave (PLC) beginning register offset to each field radio X2.
    • Register will be different whether the Single Address is checked or unchecked.

Figure 6: RTU Address and Register under the Modbus settings.

 

Single Address Checked

The base X2 and all field X2 data are sent to the same Modbus address. The RTU Address is ignored. The RTU Register is an offset from the Base Register described below.

  1. Example: Base X2 Address = 1; Base Register = 0; RTU Register = 1000
    • Base X2 Modbus address = 1
    • All field X2 radio Modbus address = 1
    • Base X2 begin register = 0
    • First field X2 radio begin register = 0 + 1000 = 1000
    • Second field X2 radio begin register = 0 + 2000 = 2000
      • and so on…

 

Single Address Unchecked

The base X2 and each field X2 data are sent to a separate Modbus address.  The RTU Address for each field X2 radio begins with an offset of 10 from the base radio, with a subsequent increase in the address number for each field radio as described below. All field radio X2 data is sent to the same beginning register (RTU Register).

  1. Example: Base X2 Address = 1; RTU Address = 10; Base Register = 0; RTU Register = 0
    • Base X2 Modbus address = 1
    • First field X2 radio Modbus address = 10 + 1 = 11
    • Second field X2 radio Modbus address = 10 + 2 = 12
      • and so on…
    • Base X2 begin register = 0
    • Each field X2 radio begin register = 0

 

Once all changes have been made, click Save Setting to X2.

 

Register Mapping

  1. The first parameter is always a 32-bit big Endean UTC epoch time stamp (number of seconds since midnight 1/1/1970). The following web converter can be used to convert to a readable timestamp.
    • Epoch Converter – This timestamp is mapped to the first register specified in Base Register or RTU Register.
  2. Each measured parameter is mapped to the next register. An online converter below can be used to convert from a 32-bit hex representation to a readable floating point number.
    • Float Converter
      • Example:
        1. Base Register = 0
        2. Timestamp = 0x4EBED3CA
        3. First Parameter = Temperature
          1. Measured Value = 22.14 C (0x41B11EB8)
        4. Second Parameter = Depth
          1. Measured Value = 2.79 m (0x40328F5C)

 

RegisterHex ValueNote
0x00000x4EBEMost significant 16-bit of timestamp (9/22/2020 11:50:00)
0x00010xD3CALeast significant 16-bit of timestamp
0x00020x41B1Most significant 16-bit of temperature (24.14 C)
0x00030x1EB8Least significant 16-bit of temperature
0x00040x4032Most significant 16-bit of depth (2.79 m)
0x00050x8F5CLeast significant 16-bit of depth

 

 

Example Modbus Output

The following example represents an X2 radio network including one base and one field radio. The base radio is connected to the PLC where data from both units is uploaded. The field radio contains a 19HVS GPS unit and (3) NexSens T-Node FR sensors.

Example Modbus OuputDescriptionUnitsRegister NumberValue from Example Output
1Base Data Logger Address1
10Modbus Function (Holding Register)16
00 00Register number0
00 1A# of Registers26
34# of bytes52
61 AF 5D 28Date and Time (UTC)0Tuesday, December 7, 2021 8:10:00
40 58 93 AFProcessor PowerVolts23.38
40 3D 3F 4BRTC PowerVolts42.95
40 95 E3 27Primary PowerVolts64.68
3D 55 76 28Secondary PowerVolts80.052
41 41 25 30Sensor PowerVolts1012.07
43 3A 09 00Total System CurrentMilliAmps12186.03
3F E1 00 00Sensor CurrentMilliAmps141.75
44 79 4E BDInternal PressuremBar16997.23
41 9F D2 04Internal TemperatureC1819.97
3E C9 52 43Internal Humidity%200.39
C2 AA 00 00Cell Signal StrengthdB22-85
00 00 00 00Cell Status240
97 C7Checksum
1Field Data Logger Address1
10Modbus Function (Holding Register)16
03 E8Register number1000
00 26# of Modbus Registers38
4C# of bytes76
61 AF 5D 28Date and Time (UTC)1000Tuesday, December 7, 2021 8:10:00
40 56 08 C7Processor PowerVolts10023.34
40 3C F1 50RTC PowerVolts10042.95
41 4C E2 F6Primary PowerVolts100612.8
3D 9D 36 27Secondary PowerVolts10080.076
41 3F DF 3BSensor PowerVolts101011.99
42 D4 80 00Total System CurrentMilliAmps1012106.25
42 3D 42 00Sensor CurrentMilliAmps101447.31
C7 C3 82 00Internal PressuremBar1016-100100
41 C4 D5 60Internal TemperatureC101824.6
3F 32 20 00Internal Humidity%10200.69
C2 9A 00 00Cell Signal StrengthdB1022-77
00 00 00 00Cell Status10240
41 AD B0 FDTemp 00C102621.71
41 AF 0D CDTemp 01C102821.88
41 AB 6B 5DTemp 02C103021.42
42 1F 21 60LatitudeDeg103239.78
C2 A7 FC DCLongitudeDeg1034-83.99
43 66 CC CDAltitudem1036230.8
AB 7CChecksum

 

Testing Communication

Communication between the X2 data logger and PLC can be determined using the Test button on the Modbus Output interface. If the data below is received by the PLC, Modbus output communication is confirmed.

  • The Test button sends the following data to the PLC:
    • 0x01020304