How to map Keyence HR-X EtherNet/IP I/O

How to map Keyence HR-X EtherNet/IP I/O https://forum.weintekusa.com/uploads/db0776/original/2X/9/9bf17c7c6f07a39d77349f53d7d4d946e96c09dd.png
none 0.0 0

Hello,

First I’ll start by this is my first project in Codesys. I am used to programming with Rockwell products.

I am having an issue mapping Ethernet I/P I/O from a Keyence HR-X scanner. I have the EDS file loaded in. The issue I am having is in the Assemblies it shows the Input “Result Data” to be a BYTE with a bit length of 1024.

image

And when I try mapping a variable in the I/O mapping it only brings in the first 8 bits.

Is there a way to get this to come in with the array of 128 bytes? What am I missing?

Thank you,

Hi @vick32w ,

Thank you for your question.

Could we another screen shot that capture the full array structure setup so we have a better idea of the project.

Thank you

It will be a few screen shots. It’s quite a big setup from the EDS.
Assemblies:


I/O Mapping:

As you can see, I tried making an array of 128. I started with bytes and now I am using sints just to try. I am getting the same result. Everything after the “Read Data” is all outputs, which if I need to use those that should be simple enough as it will just be the bit level. My main concern is getting all of the scan/read data in. But it is only bringing in the one byte

I think I actually got it figured out. I changed the Read Data bit length to 8 and then made 128 of the Read Data’s all with bit lengths of 8. I was then able to map multiple tags to each of the Read Data’s and all the data is coming in. A bit tedious, but it is working!

Hi @vick32w ,

We are glad to hear you were able to solve your issue and thank you for uploading your solution to help out others as well.

Please feel free to reach out if you run into any other issue in the future!

Thank you!

There’s a lot of different ways to do this in CODESYS as there are far more tools at your disposal vs RA.

If you just want to get it to an intermediary array. Pointers can speed it up.

To keep it more portable, instead of letting it create a new var for the pointer to use, make that var a part of the FB for the device. Then do the work within that device to map it. They are pointers though, so use with caution.

Another easier to troubleshoot way that is time consuming but has some benefits, is direct mapping. Little easier on something like a VFD, less practical on items with huge data arrays.

Don’t forget the power of a UNION as well when trying to put BYTEs back together or mixing data types.