I have a Cognex Insight Camera that is reading a barcode and sending it to my PLC (Logix 5000). I am using Cognex add on profile for communication. I have the first 32 bits of the
TAG:"camera.I.InspectionResults" designated for the read barcode.
I then copy this data into a local TAG "Read_String" for further processing.
Typically the barcode is a fixed length of 24 characters. In this case I adjust the length of my "Read_String" TAG to 24 and everything works fine. If I set the length to more than 24 then I get Null characters included on the end of my "Read_String" which causes me issues later. So I need to make certain to set the length correctly.
Recently, my customer is starting to change the barcode length.
I am wondering what my options are for a more dynamic method of determining the barcode length.
I was going to experiment with an FSC instruction to find where the first null character is (Based on a previous tip I was given).
However, I am curious about using a SIZE instruction. Would the size instruction tell me the length of all characters including the Null characters? Or would it just give me the length of the string and not count the Null characters. That would be nice.
I would experiment with this myself but I do not have a access to PLC at the moment.
Does anyone have a thought on this potential solution path.
Thanks