Hey everyone,
I’m currently working on a B&R demo station, and one of the things available for me is a Cognex DM300X scanner, which can do Ethernet IP or Modbus. My IO system is an X20BC0083, which seems to only do Powerlink. Is it possible to for the PLC to talk to the Barcode scanner right now, or is additional hardware needed?
Hi,
I assume the Cognex station supports Modbus TCP (via Ethernet TCP/IP, not the serial Modbus RTU), am I right?
Then, for both variants of communication no additional hardware is needed, and the Ethernet interface of the PLC can be used, please see the links to th Automation Help:
- For Ethernet/IP there’s a library AsEthIP.
- For ModbusTCP, the PLC can be configured as a ModbusTCP master or a slave.
Best regards!
Hey Alexander, I’m having a hard time getting the EIPInit to work. I’m getting the status of 32052 which says my data object is configured wrong, and my ExtStatus is empty.
Here’s what’s in my Data Object:
“#OWNIP=192.168.10.15”
“#OWNINTERFACE=IF2”
“#STATION=EmptyBase-DM300X”
“#STATIONIP=192.168.10.50”
“#STATIONSTATUS=udTestStationStatus”
“#CONNAME=ConnBarcode1”
“#CONDIR=BOTH”
“#CONRPI=20”
“#INPUTASSEMBLY=IAssemBarcode1”
“CIPTestIb1, BOOL”
“CIPTestIb2, BOOL”
“CIPTestIusArr, SINT, 10”
“CIPTestIuiArr, INT, 10”
“CIPTestIdArray, DINT, 116”
“#OUTPUTASSEMBLY=OAssemBarcode1”
“CIPTestOb1, BOOL”
“CIPTestOb2, BOOL”
“CIPTestIusArr, SINT, 10”
“CIPTestOuiArr, INT, 10”
“CIPTestOdArray, DINT, 115”
I’ve confirmed the IP addresses and IF2.
This is my logic in an Init program, where the name of the .dat file of the Data Object is DOBarcode1:
And here’s my function block behaving strangely:
Any idea what’s happening here?
Thanks,
The Error Message tells us to look in to the String… but the String in your Watch is Empty…
← Removed my guess →
Just another Question… did you used the INIT part of the Task, like descriped in Help. Just another quess as this could be a possible trap.
So I converted my ladder logic into ST and it’s still doing the same thing.
However, I just learned that you can create Data Objects in Logic view, I’ve been putting them in Configuration View. Perhaps its the location where I’m putting DOBarcode1 that’s causing the issue? I’m testing out a bunch of locations to create my Data Object, but none are working so far. Where do people normally create it?
Edit: The ST btw
The current location of my Data Object:
This should be a valid location for the DataObject. I was considering the length but with 10 characters its at the limit were both are the same. You have to consider the Name in the Software “CPU.sw” File.
The Help mentions that there must be a bunch of Global variables which will be accessed by the System due to the content of the DataObject. Have these Variables been used in the code?
if they are not used, the compiler will not create Memory for them. This should be visible as a compiler warning.
PROGRAM _INIT
udTestStationStatus;
CIPTestIb1;
//.... other Variables
END_PROGRAM
Hmm, still getting the same empy extstatus string.
So my Data Object wasn’t in the cpu.sw so I threw it in there:
I also declared all of the variables in the Data Object globally:
But ya, the problem still persists.
In fact, the use of data objects is new to me in general, I don’t really have much of an understanding of it yet. What actually happens when I write something like “CIPTestIb1, BOOL” in it? Is it declaring a variable for me?
Hello JackLin,
The AsEthIP library only implements communication as an EthernetIP Adapter (slave) device. Communication with the Cognex DM300X device will only function if it is the EthernetIP Scanner (master) device. If you want to use the B&R PLC as the EthernetIP Scanner, then you need to add an X20IF10D1-1 to act as the EthernetIP scanner on your system. Additional hardware is not required to act as a ModbusTCP Client (master) device.
There is an issue with your ST implementation (the same is in your LD), where you are using the wrong quotes to denote a STRING.
See the definition of STRING, WSTRING in the AS Help at: B&R Online Help (br-automation.com).
Welp, it looks like the double quote was the issue. I actually get the extstatus now:
And (5) is the STATIONIP I’m guessing:
And this is probably related to the master slave issue you brought up. I suppose that’s the next thing I’ll look into, thanks Austin
Hi,
The Library is using the DataObject as a source of configuration Data. Back in the Days it was an easy way to bring persistend but easy to modify Data into the System. A more modern aproach would be the mapp-Config File for comparison.
The contend ist Parsed by the Library and then the Library uses the Data and tries to access (compare pvxGetAdress) the Variable namend in the DataObject. The Object itself is only the way how to transport the Data.
I hope i could clarify the DataObject a bit.
Thanks Austin for having a good eye to the quotes!
Greetings
Michael
If there is Variable not found, you should at least use them in Code and have them in Watch… if not yet done so.
Only to declare them in the global.var like descriped above will not lead to have them on the system. They must be used.
I think 5 counts to the used lines… as line 1 is empty. And the line 6 is containing the first Variablename.
To use Variables in ST you can use this Syntax. VariableName;
PROGRAM _INIT
udTestStationStatus;
CIPTestIb1;
//… other Variables
END_PROGRAM
Greetings
Michael
Welp, it looks like the double quote was the issue. I actually get the extstatus now:
And (5) is the STATIONIP I’m guessing:
Note that line numbers returned by the EIP_INIT function ignore comments and blank lines. Data objects are simple data containers.
“#STATIONSTATUS=udTestStationStatus”
The particular error you are experiencing is that you haven’t properly defined udTestStationStatus and used it in a deployed program on your PLC.
And this is probably related to the master slave issue you brought up. I suppose that’s the next thing I’ll look into, thanks Austin
You will not receive an error for two Adapters waiting for communication from a Scanner, only non-functionality. It’s not an error on the Adapter (passive communication agent) for the Adapter to not be connected to by a Scanner, just a lack of functionality. It would be an error on the Scanner (active communication agent) that there was no connection to a configured Adapter.
Analogy (because I love them): The Adapters are cashiers at a fast-dining restaurant. They stand at their registers waiting for customers (Scanners) to make orders. It’s not an error of the cashier to not have any customers, but it would be an issue if a customer walked up to order and the cashier wasn’t there or able to take their order.
(aaaaand Michael beat me to it while I fine-tuned the analogy… such is life)
Yep, looks like the real cause of the error was because I had to use all of the created tags in my program, I finally have “no errors” in my extstatus. I misunderstood Michael on his earlier post, I thought that if I wouldn’t see the “variable is declared but not used in current config” compiler warning, then I wouldn’t have to do this, and I never got that warning so I ignored it. But ya, it seems that everything works good now.