# Modbus Setup for Cognex Barcode Scanners

**URL:** <https://forum.inductiveautomation.com/t/modbus-setup-for-cognex-barcode-scanners/28205>\
**Category:** Ignition\
**Created:** [September 12, 2019, 1:31pm UTC](https://forum.inductiveautomation.com/t/modbus-setup-for-cognex-barcode-scanners/28205 "2019-09-12T13:31:16Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![wking](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/wking/32/21823_2.png) [@wking](https://forum.inductiveautomation.com/u/wking)\
**Post date:** [September 12, 2019, 1:31pm UTC](https://forum.inductiveautomation.com/t/modbus-setup-for-cognex-barcode-scanners/28205/1 "2019-09-12T13:31:16Z")

</div>

I’ve never used Modbus before. So I appreciate any help I can get. I’ve tried a myriad of different connection address mappings and usually get something like the following back.

```auto
E [d.M.ReadHoldingRegistersRequest] [13:14:40]: Uncaught Throwable handling response. key=java.lang.Object@61545f1b, req=[], rsp=[00 03 03 FF 00 03 F5 2E] device-name=Test Device Scanner
INFO | jvm 1 | 2019/09/12 08:14:40 | java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3
INFO | jvm 1 | 2019/09/12 08:14:40 | at com.inductiveautomation.xopc.driver.util.OldByteUtilities.getInt(OldByteUtilities.java:126)
INFO | jvm 1 | 2019/09/12 08:14:40 | at com.inductiveautomation.xopc.driver.util.UAByteUtilities.getInt32(UAByteUtilities.java:155)

```

or

```auto
| 2019/09/12 08:25:57 | W [d.M.RequestSchedule] [13:25:57]: Rescheduling; error handling subscription change: java.lang.RuntimeException: Couldn't parse ModbusAddress from "cb1000". device-name=Test Device Scanner

```

Device info can be found here… on pg 82 [https://www.hvssystem.com/documentations/Cognex/Dataman/CommunicationsAndProgramming.pdf](https://www.hvssystem.com/documentations/Cognex/Dataman/CommunicationsAndProgramming.pdf)

 ![mod%20table](https://us1.discourse-cdn.com/inductiveautomation/original/2X/6/6b91bccca5e0b9719a4f31c422e5c21b18ce58b2.jpeg)

Do you have to map an entire device? I tried the whole thing and just pieces and can’t ever get not bad tag state.

 ![set](https://us1.discourse-cdn.com/inductiveautomation/original/2X/a/a304a1c60a4e411b51015db8f03435add4014f92.jpeg)

---

<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:** [September 12, 2019, 1:36pm UTC](https://forum.inductiveautomation.com/t/modbus-setup-for-cognex-barcode-scanners/28205/2 "2019-09-12T13:36:19Z")

</div>

Easiest way to get started is to forget the mapping for now and just go into the designer and make a single tag with an OPC Item Path of “[DeviceName]HR1” or whatever Holding Register offset you want to get data from.

The addressing is discussed in the manual: [https://docs.inductiveautomation.com/display/DOC80/Modbus+Addressing](https://docs.inductiveautomation.com/display/DOC80/Modbus+Addressing)

It also looks like you may have chosen the “Modbus RTU over TCP” driver instead of just the Modbus TCP driver. Or perhaps the device is actually RTU over TCP and you _do_ need to choose that driver.

---

<div class="post-metadata">

**Author:** ![wking](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/wking/32/21823_2.png) [@wking](https://forum.inductiveautomation.com/u/wking)\
**Post date:** [September 12, 2019, 1:59pm UTC](https://forum.inductiveautomation.com/t/modbus-setup-for-cognex-barcode-scanners/28205/3 "2019-09-12T13:59:06Z")

</div>

Wow, I am an idiot. It’s supposed to be Modbus TCP. Thanks bro.

---

<div class="post-metadata">

**Author:** ![cognex\_information](https://avatars.discourse-cdn.com/v4/letter/c/b4bc9f/32.png) [@cognex\_information](https://forum.inductiveautomation.com/u/cognex_information)\
**Post date:** [September 16, 2019, 3:12pm UTC](https://forum.inductiveautomation.com/t/modbus-setup-for-cognex-barcode-scanners/28205/4 "2019-09-16T15:12:55Z")

</div>

Hi @wking for future reference, documents like this can be found in [the MyCognex portal](https://support.cognex.com/en/Home/login) for customers.  
You can register products, download manuals, get support documentation, and contact our support team. Happy to see you’ve already connected successfully though!

---

<div class="post-metadata">

**Author:** ![luis.3.flores](https://avatars.discourse-cdn.com/v4/letter/l/8491ac/32.png) [@luis.3.flores](https://forum.inductiveautomation.com/u/luis.3.flores)\
**Post date:** [August 18, 2020, 9:39pm UTC](https://forum.inductiveautomation.com/t/modbus-setup-for-cognex-barcode-scanners/28205/5 "2020-08-18T21:39:30Z")

</div>

I am trying to connect to my dataman 363 using Ignition Modbus TCP, but I haven’t been able to figure it out how. Can you show what addressing you used ?

---

<div class="post-metadata">

**Author:** ![wking](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/wking/32/21823_2.png) [@wking](https://forum.inductiveautomation.com/u/wking)\
**Post date:** [August 18, 2020, 9:40pm UTC](https://forum.inductiveautomation.com/t/modbus-setup-for-cognex-barcode-scanners/28205/6 "2020-08-18T21:40:55Z")

</div>

@luis.3.flores I just used a TCP driver. Over the telnet port.

---

<div class="post-metadata">

**Author:** ![luis.3.flores](https://avatars.discourse-cdn.com/v4/letter/l/8491ac/32.png) [@luis.3.flores](https://forum.inductiveautomation.com/u/luis.3.flores)\
**Post date:** [August 20, 2020, 2:12pm UTC](https://forum.inductiveautomation.com/t/modbus-setup-for-cognex-barcode-scanners/28205/7 "2020-08-20T14:12:37Z")

</div>

I was able to use modbus tcp.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/0/003a604399d1d721f34cf946f0bc756c0b6c1c7e.png)

---

<div class="post-metadata">

**Author:** ![wking](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/wking/32/21823_2.png) [@wking](https://forum.inductiveautomation.com/u/wking)\
**Post date:** [August 20, 2020, 2:31pm UTC](https://forum.inductiveautomation.com/t/modbus-setup-for-cognex-barcode-scanners/28205/8 "2020-08-20T14:31:08Z")

</div>

Nice! thanks for coming back and updating!

---

<div class="post-metadata">

**Author:** ![wking](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/wking/32/21823_2.png) [@wking](https://forum.inductiveautomation.com/u/wking)\
**Post date:** [August 24, 2020, 7:21pm UTC](https://forum.inductiveautomation.com/t/modbus-setup-for-cognex-barcode-scanners/28205/9 "2020-08-24T19:21:57Z")

</div>

[Cognex\_Barcode\_Scanner.json](https://forum.inductiveautomation.com/uploads/short-url/ufT60cxFRtu2maxYrgIZfEvwbWp.json) (9.2 KB) [cognex-modbus-config.csv](https://forum.inductiveautomation.com/uploads/short-url/xzJlU8KTmYvEgErroKurx7QPtW5.csv) (68 Bytes)

UDT, Address Map and for connecting to any Cognex BC Scanner. Just add device name to params of UDT:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/2/a22b61764d5aba349f489c76cd55d5bd6aa9a688.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/3/138f22dbebc85fdbab8e1537d74582f28f38dfac.png)

And when making new device check Reverse String Byte Order under advance properties.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/7/a7465eac53086a383d1f63584ff4e0960064169e.png)

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

Upload mapping… And import config CSV.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/6/46fd219ecd8ca03625590dda3fa010bfc42b6499.png)

Make a UDT instance. Fill in para Device Name with the proper Device name.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/4/64ce912e41dfec4eda32a06c24cb7b3b1c734af4.png)

I will eventually add DMCC functionality and some other stuff.
