RSlogix 5000 ASCII processing

Petr_Broza

Member
Join Date
May 2015
Location
Vancouver
Posts
41
Hi guys,

I got barcode scanner, which give me each character as SINT (style is ASCII), I want to put all these characters in one string, which will be matching actual code (so if scanner gives me 'A' 'B' 'C' I want to get 'ABC' not decimal ascii interpretation '656667'). I tried to use CONCAT, which work only with string, so I used DTOS, which gives me decimal interpretation of ASCII character. So is there any way how to put these characters in string tag?

Thanks for any help

Petr

-----------
Rslogix 5000, CompactLogix L24ER, Cognex DataMan 8050
 
Looks like I need more sleep. Solution is very simple, all it need is COP instruction, and copy all character to string. Didn't know I can copy operands with different data types (SINT to STRING).
 
Thanks for posting the solution. It may have turned out to be simple for you, but it was definitely over my head.



Will.
 
I don't know how it is possible it's working, cause even a Help for COP function says: "Important: the Source and Destination operands should be the same data type, or unexpected results may occur"
But actually it is right, unexpected result really occurred in good way.
 
Actually COP is very good at moving data between data types *when you don't want it to try and interpret the data in any way*. COP just copies the data bit for bit without regard for datatypes. Normally, if you COP a DINT to a REAL, expect garbage as a result. If that DINT happens to have data in REAL format in it, like from a Modbus message, then COP it to a REAL tag and it works.
 
A STRING consists of a .LEN (DINT) and .DATA (Array of SINTS). I wrote a long-winded post here, but I'm hoping a single picture might be worth my thousand words :D

STRING.jpg
 
Adding to that picture, here's a dodgy one, and a slightly less dodgy one.

Barcode_LADDER.jpg Barcode_ST.png
 
Last edited:

Similar Topics

I am trying to send a command string via the serial port of a Logix5555 processor to an Omron RFID controller. Using a SLC 500 I can send this...
Replies
2
Views
4,401
Hello, I am trying to read a barcode scanner input using a cognex dataman 280 barcode reader, store it another string, the compare with another...
Replies
1
Views
81
Hi folks, in the alarm manager of Rslogix 5000, the tag-based alarm has been created. But when I tried to change the condition, it was found the...
Replies
2
Views
190
I am completely stuck on building a ladder program that requires a start button to be pressed 3 times to turn on motor 1. Then motor 2 starts...
Replies
20
Views
634
Back
Top Bottom