help with convert barcode ascii array into string

lunknowl

Member
Join Date
Oct 2012
Location
vietnam
Posts
37
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 single string format in controllogix. i already using "COP" instruction to copy barcode[0] to barcodestring (leng 10) but it skip some characters in front.
 
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 single string format in controllogix. i already using "COP" instruction to copy barcode[0] to barcodestring (leng 10) but it skip some characters in front.

Are you losing 2 characters? I think you want a COP of barcode[0] to barcodestring.data[0] with LEN 10 as the .data tag is the SINT array in the string data structure?
 
Last edited:
well i change the LEN but nothing. i get all the data in string now by using copy BARCODE[0] to BARCODE_STRING[4] (len 20, i skip 4 place for missing character). then i copy BARCODE_STRING[0] to BARCODE_STRING_SINGLE (len 1, and the data is like this OBD9L$00$00$00$00$00$00$00$00$00$00$00$00$18$00$00$80$07$00$00$80$B4N$F5$00$B8$00$08$00$C1$00) i change the len, do the find, search, mid but nothing.
 
Here's a thought a sting is an ASCII array (each element in the string is an ASCII character)
you say the scanner returns a an ASCII array of 10 characters
that character string represents an SINT value
if you want to copy the ASCII array to string array they are both ASCII arrays

You should be able to just copy from one to the other with a length of 10
you can convert from INT to STRING using an ASCII converter
 
Here's a thought a sting is an ASCII array (each element in the string is an ASCII character)
you say the scanner returns a an ASCII array of 10 characters
that character string represents an SINT value
if you want to copy the ASCII array to string array they are both ASCII arrays

You should be able to just copy from one to the other with a length of 10
you can convert from INT to STRING using an ASCII converter

???? like i say i already have a string array (let say 10 character) then i need to combine these string array into 1 string element so i using COP string_array[0] to string_combine len 10 but it coming out with extra character (123ABC78911$00$00$00 )
 
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 single string format in controllogix. i already using "COP" instruction to copy barcode[0] to barcodestring (leng 10) but it skip some characters in front.

A string is like a UDT with a .LEN that is a DINT and .DATA that is an array of 82 SINTs

You can manually copy your SINT array into string_combine like this

Cop BARCODE[0] string_combine.data[0] 10
mov 10 string_combine.LEN

That does the first string

To add the second string manually

Cop BARCODE2[0] string_combine.data[10] 10
add 10 string_combine.LEN string_combine.LEN

To add the third string manually

Cop BARCODE3[0] string_combine.data[20] 10
add 10 string_combine.LEN string_combine.LEN

etc

That will work. Is that what you are looking for?
 

Similar Topics

i hope you could help me to convert the network Stl to lad it's apart from program of machine and i try to find solution for the reason of error...
Replies
10
Views
1,916
Hello everyone, I am migrating a program from STL to SCL via S7-1200 portal, I would like you to help me by converting these lines of code...
Replies
4
Views
1,626
Hi All i was wondering if any one would be able to help me. My version of studio5000 only allows ladder and FB. i have an AOI written in structure...
Replies
2
Views
1,533
Can someone please help me out and print this entire program to a PDF. Tried to zip and upload but too big so Google drive Link below to the adc...
Replies
2
Views
1,247
Hello, I am trying to figure out how to create / write / delete a .csv file on the SD card of an Allen Bradley PLC. There is a sample project...
Replies
1
Views
1,429
Back
Top Bottom