# Modbus TCP driver to RS485 Device

**URL:** <https://forum.inductiveautomation.com/t/modbus-tcp-driver-to-rs485-device/22194>\
**Category:** Ignition\
**Created:** [January 29, 2019, 4:37pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-driver-to-rs485-device/22194 "2019-01-29T16:37:06Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Special\_tec](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@Special\_tec](https://forum.inductiveautomation.com/u/Special_tec)\
**Post date:** [January 29, 2019, 4:37pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-driver-to-rs485-device/22194/1 "2019-01-29T16:37:06Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/6/6eb7e3921b1d3bb352f90c11a9064cc20e4be457.png)

I am trying to replicate the modbus enquiry in the image and would like to know how to add this request in MODBUS TCP driver. I am attempting to send this request via a TCP driver to a MOXA 3280 and ten on through slave ID 1 2 wire RTU RS485

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/b/b5c4bab8fc0f2991fb6ab06b192ddf5d2e1e96fe.png)

from this I seem to get a transmit signal pulse from the Moxa every coupleof seconds but there is no receive. Having created a tag this toggles between green and red as shown.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/4/4c76393b613da47c92dbe6d71773b338ab68412f.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/a/aee0357a90f7a6b6626e7c7ae81be2d9896f605b.png)

I am missing something somewhere and would appreciate any feedback.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [January 29, 2019, 5:23pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-driver-to-rs485-device/22194/2 "2019-01-29T17:23:44Z")

</div>

Why do you have unit ID set to 0 instead of 1?

---

<div class="post-metadata">

**Author:** ![Special\_tec](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@Special\_tec](https://forum.inductiveautomation.com/u/Special_tec)\
**Post date:** [February 1, 2019, 3:27pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-driver-to-rs485-device/22194/3 "2019-02-01T15:27:42Z")

</div>

Initially I had this set to 0 and then 1 attempting to get a response only due to the university clip.  
since then i have connected via my laptop using a RS232 to 2 wire 485 converter direct to the unit and these are the results.  
I am also asking Moxa for support but am sure they will come back with the way that Ignition is set up.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/e/e702a4f060c2b89d53c5196537935140ae738233.png)

---

<div class="post-metadata">

**Author:** ![Special\_tec](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@Special\_tec](https://forum.inductiveautomation.com/u/Special_tec)\
**Post date:** [February 7, 2019, 3:29pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-driver-to-rs485-device/22194/4 "2019-02-07T15:29:06Z")

</div>

Having managed to get data from the Modbus device i have then used a TCP client to request data through the Moxa serial converter.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/8/8f9fd9c949582132a6df119ffa2f45a9a48350ff.png)

The device settings in Ignition are as below

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/9/9497ca196ecfa3c758a7e45efc1475e1ef4db650.png)

This then gave the tags

![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/e/e409cd28ceb80928c2cdc1c31cdef318c48df98f.png)

I am unable to change the data source to equal the same results as per the TCP client and need some assistance, also the data only changes when the request is sent via the client so is there a way to send a request with the device set up?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 7, 2019, 3:31pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-driver-to-rs485-device/22194/5 "2019-02-07T15:31:21Z")

</div>

Have you tried setting the starting “Modbus Address” to 1 instead of 0?

---

<div class="post-metadata">

**Author:** ![Special\_tec](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@Special\_tec](https://forum.inductiveautomation.com/u/Special_tec)\
**Post date:** [February 7, 2019, 3:33pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-driver-to-rs485-device/22194/6 "2019-02-07T15:33:39Z")

</div>

Great that has now fixed the update issue.

---

<div class="post-metadata">

**Author:** ![Special\_tec](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@Special\_tec](https://forum.inductiveautomation.com/u/Special_tec)\
**Post date:** [February 13, 2019, 2:37pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-driver-to-rs485-device/22194/7 "2019-02-13T14:37:22Z")

</div>

Although it fixes the issue on 1 address (G41) is then does not work on the second (G4) is there a way to regulate the scan? if the Modbus address is 1 then i get a null response but if it is 0 then i get values but no update?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/1/1853b7884414235a82a17a9dbdd61404c2d16cc3.png)  
if I do a scan on the simply Modbus TCP client this then updates the holding registers.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 13, 2019, 2:47pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-driver-to-rs485-device/22194/8 "2019-02-13T14:47:04Z")

</div>

Unless you’ve changed the “One-based addressing” setting on the driver to be false, starting at Modbus Address 0 is going to be wrong and you should stop tinkering with that. I can see from the Modscan logs that it’s set up the same way Ignition’s driver is (40001 == HR1 == protocol offset 0).

It might help if you captured some Wireshark logs with those 2 mappings set up starting at Modbus Address 1, but it’s starting to sound like the device you’re talking to on the other end is junk.

---

<div class="post-metadata">

**Author:** ![Special\_tec](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@Special\_tec](https://forum.inductiveautomation.com/u/Special_tec)\
**Post date:** [February 28, 2019, 12:44pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-driver-to-rs485-device/22194/9 "2019-02-28T12:44:47Z")

</div>

Finally worked out that the junk at the end as so nicely put can only handle certain requests and 6 was the magic number for the 2 devices to get the data I require.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/1/1a20b1d14bc38d66b9cb131bc8e06a2a8c0c91a0.png)

Also the HR should have been looking for unsigned integers which is why making the figures all wrong.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/f/f9ea8fdeb2707600388364402b363e1978aa7c62.png)

The next issue I have is to mathematically work out in ignition the sum of 1\_G1\_4 in hex (8=8) and 1\_G1\_5 in hex (19754=4D2A ) then put the 2 together giving 84D2A finally then transfering this back to decimal 84D2A=544042  
Does anyone have any idea how to do this? I will trawl the forum for similar questions but probably know i would be the only one asking for this!

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 28, 2019, 1:06pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-driver-to-rs485-device/22194/10 "2019-02-28T13:06:37Z")

</div>

Something like this in an expression tag: `fromHex(toHex({[~]Tag1})+toHex({[~]Tag2}))`

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 28, 2019, 2:01pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-driver-to-rs485-device/22194/11 "2019-02-28T14:01:55Z")

</div>

Any reason you aren’t using the HRI or HRUI [address formats](https://docs.inductiveautomation.com/display/DOC79/Modbus+Addressing)?

---

<div class="post-metadata">

**Author:** ![Special\_tec](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@Special\_tec](https://forum.inductiveautomation.com/u/Special_tec)\
**Post date:** [March 1, 2019, 2:35pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-driver-to-rs485-device/22194/12 "2019-03-01T14:35:33Z")

</div>

Phil, I did try using the manual formatting but again it returned a null reading although I would have had to use an HRUS and it seems throughout this challenge the Modbus info from the meter manufacturer was poor.  
As for the expression tag this worked perfectly, thanks Kevin.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 1, 2019, 2:55pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-driver-to-rs485-device/22194/13 "2019-03-01T14:55:25Z")

</div>

> [@Special\_tec](#):
>
> would have had to use an HRUS

No, HRUS is a 16-bit value. Kevin's expression combines two 16-bit values into a 32-bit value. HRI or HRUI should have worked. Consider skipping the mapping in the device (it's optional) and directly entering `[devicename]2.HRI4` in a new tag's OPC item path.
