• June 01, 2023, 06:59:26 PM

Login with username, password and session length

Author Topic: ECOM100 Modbus to Cognex Camera  (Read 4457 times)


  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2109
    • ATU, Inc.
ECOM100 Modbus to Cognex Camera
« on: June 20, 2007, 09:34:31 AM »
Trying to talk Modbus with an Cognex Insight 5000 Camera.
Not having much success.

Here is what I have so far.
It requires full compatibility with Ethernet II (802.3). 
Modbus Port 502
Testing on an 06, Slot 4 with a brand new ECOM100
I set up the PEER to PEER connection in Net Edit as Modbus/TCP Device 1
with the IP the same as the camera, Port 502 and UNIT ID= 0 (the Cognex Examples set this 0)

Decided to skip the IBoxes, because the eventual target system may not have the firmware needed
I am trying to write to cell F4 from the PLC,
using the camera as the Modbus Server, ECom100 as the Client Function Code 3

My short test program is in a stage.

LD K401
LD k2
LDA 012004
WX V10000

I have some numerical data in V10000 and V10001
I have the EDITINT function plastered in almost every cell in the Camera program

The problem must be in the Modbus Addressing
They have an example using Visual Basic and set in the data packet the destination address to HEX 1404
so I converted that to Octal (12004)

SP126 pulses
SP127 is not comming on
Yet no data is appearing in the Camera program.

My questions
Has anyone done this before?
Is the Ecom100 compatible with Ethernet II?
How is that Octal Address converted to the actual address in the data packet?

« Last Edit: June 20, 2007, 09:39:08 AM by ATU »


  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3519
    • Host Engineering
Re: ECOM100 Modbus to Cognex Camera
« Reply #1 on: June 20, 2007, 09:59:02 AM »
First, I think you have the master and slave memory addresses backwards?  If you wish to write the data in V10000 and V10001 then you would use LDA O10000 (the master source data address).  Then put V12004 in the WX instruction (the slave destination address).

Also, if you want to write V10000 (2 byte register) and V10001 (another 2 byte register), then this is 4 bytes.  Change your LD K2 to LD K4 (it's number of bytes, not number of registers).  This will actually write to the camera's hex modbus addresses 1404 and 1405.

Your questions about the addressing are quite relevant.  In Modbus, the user addresses are decimal, starting at 1.  However, at the protocol level, the addresses are zero-based, so the client/master protocol software will subtract 1 from the "user" address, giving the "protocol" address (the bits in the bit stream).  Therefore, if the Basic code that simulates the PROTOCOL (i.e. it's a protocol address, not a user address), says to use HEX 1404, then I am guessing that your calculation is correct (I think ECOM100s need protocol addresses, not user addresses???).

The best way to tell is to see if you get your desired results.  It's bad enough that the Modbus wire protocol address is off-by-one than the Modbus user address, then throw in the ADC element octal mapping you have to use, it gets a little crazy real quick.  :-\

Someday, we'd like to have a Modbus RX/WX IBox for the ECOM100!  :)


  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2109
    • ATU, Inc.
Re: ECOM100 Modbus to Cognex Camera
« Reply #2 on: June 20, 2007, 03:24:17 PM »

It's easy to get turned around. I didn't realize until you pointed it out that the Vxxxxx could be the Modbus address. I was thinking Vmemory not destination.  After I changed that around, it worked.  Thanks for the help.