kckku Posted August 17, 2021 Report Posted August 17, 2021 I have a Keyence XG-X vision system and part of its function is to read a 2D matrix code on a label to verify the content. The vision system communicates to the PLC using EtherCAT and I noticed that I can't assign an array to any of the EtherCAT variables. Previously when I was using EtherNet/IP, I would just use an array for the result data. Then I would convert the result to string using the AryToString instruction. Now it seems I have to write code to populate each array element independently from the EtherCAT variables before using the AryToString instruction. Is there a better way to do this? It's not so bad if the code content is short but some codes have 68 digits and it will be a problem. Thanks in advance for any comments or suggestions.
photovoltaic Posted August 17, 2021 Report Posted August 17, 2021 After installing the ESI file it seems that the Result data is all in DINT form. Not much we can do about this. There isn't a smooth way to do this but what I would do is make a string and a DINT array. Manually map the DINTs from your IO map to the DINT array. It will be a lot of moves but an inline structured text box ill make it fairly clean. In your global variables assign a starting address to both of them. This will constantly convert the DINTs from the camera into a string and you can decide whether or not to use it in your program based on other vision tool results.
kckku Posted August 18, 2021 Author Report Posted August 18, 2021 (edited) 17 hours ago, photovoltaic said: After installing the ESI file it seems that the Result data is all in DINT form. Not much we can do about this. There isn't a smooth way to do this but what I would do is make a string and a DINT array. Manually map the DINTs from your IO map to the DINT array. It will be a lot of moves but an inline structured text box ill make it fairly clean. In your global variables assign a starting address to both of them. This will constantly convert the DINTs from the camera into a string and you can decide whether or not to use it in your program based on other vision tool results. Thanks for the feedback. I have resorted to converting each DINT to a byte and then populating an element in an array. After this I use the AryToString instruction to make the array into a string. Fortunately the 2D matrix data can be broken up in to smaller segments like part number, serial number, date code, etc. I will have individual sections for each of these strings and then check the content separately. Edited August 18, 2021 by kckku
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now