RSLogix5000 (How to Increment String)

VSGDover

Member
Join Date
Apr 2014
Location
Madison, IN
Posts
5
Sorry I'm a rookie when it comes to working with strings in RSLogix5000

I have a barcode application where I'm trying to increment a barcode string after each successful test. We use a 3 digit scheme. Can you help me out in how to achieve this ...

OIA -> OIB -> OIC

or

L5A -> L5B -> L5C
 
I don't have Logix on this machine but i would say one way you could do it is increment the value in the SINT spot for that character up one and it should move to the next letter in the ASCII table. Strings all have a data and length part of their tag. Use the string.data part which is 82 SINTs and just put a ADD +1 statement on the SINT you want to modify.
 
If the last character will always be at the same position, you can just call it out as the "StringTagName.Data[x]".

65 decimal = "A"
90 decimal = "Z"

Make a Counter that goes from 0 to 25, and add 65 to the Counter.ACC value.

Move that result (which will be from 65 to 90) into the "StringTagName.Data[x]" sub-element of the String.


A more complex versions of that involves finding the length of the string, placing your suffix character 1 place after that, and increasing the .LEN value by one.
 
You can use a lookup table. Increment the indexer and append to your string. The characters will fit into one SINT array(STRING data type)

[0] = 'A'
[1] = 'B'
[2] = 'C'

Etc.
 
Last edited:
Sorry I'm a rookie when it comes to working with strings in RSLogix5000

I have a barcode application where I'm trying to increment a barcode string after each successful test. We use a 3 digit scheme. Can you help me out in how to achieve this ...

OIA -> OIB -> OIC

or

L5A -> L5B -> L5C

What happens after OIZ or L5Z is incremented (e.g., OJA, L6A)?
 
Last edited:

Similar Topics

Hi! So my problem is a little funky, I had Studio 5000 v 24 and 30 installed, but forgot to install RSLogix (which I cannot go without). Is there...
Replies
2
Views
111
So I had an odd request from a customer for the above. I have written the logic and tested it all in one PLC with only using 7 outputs and 7...
Replies
15
Views
426
Hello everyone, I have an RSLogix5000 project which is running live in the factory but I need to make some changes to the logic. I want to test...
Replies
0
Views
1,120
Good Morning Everyone, I'm looking to use the GSV instruction to get I/O fault codes for my project so I know if there's a comms issue in my E/IP...
Replies
5
Views
863
The machine is running production. When trying to go online with the laptop the whole machine looses communication and faults out. Drives, HMI...
Replies
13
Views
1,929
Back
Top Bottom