Barcode to string conversion issues

KE8FDT

Member
Join Date
Aug 2017
Location
michigan
Posts
7
I have a Cognex 8050 barcode scanner and I am trying to pull recipes from this information. The recipes are in different locations in the string. I can find a special character in FIND command only if i can get a valid .LEN on the string. But I'm getting a Odd string LEN. Can anyone help?
 
I'm not even to that point. I try to convert the barcode data to a string with a string .LEN and I get a .LEN of over a million on something that should be around 200
 
I have tried a COP, CPS, DTOS to convert.The Barcode information comes in as a CC:DataMan_SINT256:I:0. I can change to a SINT484
 
I checked some old code of mine, I am using COP to take the data from the dataman and I am moving it into a string tag. I am also using the MOV instruction to move a number into the .len tag I have for that string. I am also using that same .len tag in my COP instruction for the length of the string. I am using both MOV and COP instructions on the same rung as well, so I define the length and move the data into at practically the same time.
 
I checked some old code of mine, I am using COP to take the data from the dataman and I am moving it into a string tag. I am also using the MOV instruction to move a number into the .len tag I have for that string. I am also using that same .len tag in my COP instruction for the length of the string. I am using both MOV and COP instructions on the same rung as well, so I define the length and move the data into at practically the same time.


When I do the COP, thats when I get the messed up .LEN. So where do I get the correct .LEN?

I need to have a SINT of 256 or 484 because of the recipe data
 
The .LEN should be defined by you. Here is a picture of what I am doing. I am using MOV to move whatever length I desire into my .len of the string.

barcode.jpg
 
So I am using SINT32, but only need 6, so I define 6 as the length of my string. You are using SINT256, but maybe only need 200, so move 200 into the .len of your string tag.
 
The length of the barcode will change as the the recipe steps will be between 5 and 20 plus the user data will change depending on the user. So the barcode could have between 50 and 400 in length
 
A question to the OP. Why did you assume that everyone would automatically know that the Cognex is sending its data to an Allen Bradley PLC? A question to alive15 and widelto. How did you know it was an Allen Bradley question? Is that particular model of Cognex scanner strictly for use with AB?
 
The string .LEN is over written to the bogus number. I can go to the monitor for that string and CTRL-C, delete string and CTRL-V back in and the .LEN comes in good.
 

Similar Topics

I'm wondering if anyone has a solution where I can use a barcode scanner to input a string into a PLC tag. All AB hardware/software. I'm aware...
Replies
8
Views
17,964
I have a barcode scanner reading bin labels and handing a string to an Laser Guided vehicle to place the bin in its appropriate location based on...
Replies
1
Views
1,261
hi, i try to capture barcode data using UDT with SINT ascii array. i have all the data i need but it in array format, how can i convert to 1...
Replies
5
Views
3,051
Hi There, I am programming a cmore EA9-T87 to gather the data and save on SD card. And this time I want to use barcode scanner to trigger the bit...
Replies
2
Views
3,499
Anyone know SATO printers? I have a PLC program that outputs strings through a serial port to a SATO printer. (See "Printer Routine" and...
Replies
7
Views
5,540
Back
Top Bottom