Manipulating Strings in RSLogix 5000 aoi written in ladder

Eoghan

Member
Join Date
Oct 2013
Location
Galway
Posts
37
Hello,
Have aoi written in Ladder to pass in and out string variables.
String VAriables that interact with PLC program are declared as InOut, while I have some variables in aoi defined as local (want to use them as comparisons)

Having issue reading the length of InOut string variable in aoi. Outside the AOI the Tag.len gives me correct value but always reading zero inside aoi.

Anybody have an aoi in Ladder available that used a lot of stings manipulation internally that I can base mine upon?
 
I have written AOIs that have strings as InOut parameters where the length (.LEN) member of the string within the AOI correctly indicates the number of characters.

I would make sure the string you are passing to the AOI actually contains data at the time the AOI is scanned.
 
When viewing the internals of the AOI, you want to make sure to observe the instance of the AOI that is being scanned, and not the generic definition. To do this, go to the routine containing the AOI of interest, right-click on the name, and Open Instruction Logic. The parameters and tags will have a white background instead of all gray, as in the AOI definition logic.
 
The following two attachments show what I was trying to describe.

AOI Definition - not being scanned, no data:

AIO definition.jpg

AOI Scanning with data:

AOI scanning.jpg
 
If the tag Source is a Local scoped tag to the AOI, you can create a tag SourceLEN that is an ALIAS to Source.LEN, but is itself an Input tag to the AOI.

I use this trick all the time with Timer actuals; keeping the Timer tag scoped locally, but exposing the .ACC to the rest of the PLC program so that everything outside the AOI can follow along. It's much cleaner than making the Timer tag an InOut type.

Another trick is that you can COP an AOI tag to a DINT[Array] of the same byte size, and then selectively COP a segment of that DINT[Array] to extract a Locally scoped String inside an AOI for use outside of the AOI.

Example:
COP AOI_Tag AOI_DINT[0] 420
(after looking in the AOI_DINT array, and changing the Radix ("Style") to ASCII and seeing that the string text starts at word [53] (spelled backwards), with word [52] having the string length:
COP AOI_DINT[52] STRING_TAG 1

Now STRING_TAG has the exact value of a tag that was LOCALLY scoped in the AOI. If I only need the value of that embedded string in one instance, it's cleaner to extract it this way than to make ALL my AOI's have strings that are InOut types, and having to pass arguments that I don't need to.

You can do this backwards, too, to pass a string without using InOut: COP the AOI to a DInt[array]; COP the STRING tag to DINT[offset]; COP DInt[array] back into the AOI.
 
Last edited:

Similar Topics

Using a 1769-L16ER-BB1B We are receiving a DINT from an external device. Then changing the sign using a SWPB order mode REVERSE dest Dint_2 same...
Replies
7
Views
3,006
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,235
Hello everyone. I have a quick question regarding dates in Structured text. What I´m trying to do is to take the current date, add/subtract days...
Replies
3
Views
1,598
Hi, I was wondering if you could help. I am using a Micrologix 1400 where I have an 11 digit number loaded in a L# data type (doubleword). This...
Replies
5
Views
2,979
I'm looking for a decent way to set independent statusbits of the statusword in simatic Step7. (CC0 - CC1 - OV - BR - etc...) When I want to set...
Replies
17
Views
3,350
Back
Top Bottom