Modbus Setup for Cognex Barcode Scanners

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.

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(
INFO   | jvm 1    | 2019/09/12 08:14:40 | 	at com.inductiveautomation.xopc.driver.util.UAByteUtilities.getInt32(


| 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

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.

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:

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.

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

Hi @wking for future reference, documents like this can be found in the MyCognex portal 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!

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 ?

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

I was able to use modbus tcp.


Nice! thanks for coming back and updating!

Cognex_Barcode_Scanner.json (9.2 KB) cognex-modbus-config.csv (68 Bytes)

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

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


Upload mapping… And import config CSV.

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


I will eventually add DMCC functionality and some other stuff.