How to Initialize Strings Inside of AOI?

Grendizer

Member
Join Date
Apr 2012
Location
Toronto
Posts
88
Hey all,


I have a local STRING tag inside of an AOI.
I want to initialize it with a value INSIDE of the AOI.


For example,
@ First scan, CONCAT("Text", "", myString);
I want myString to have a default/initail value of "Text";



Thanks,
 
i know nothing about Aoi instructions, but i have questions.
what is the purpose of initializing the aoi?
when you initialize any machine, it needs to be in the home state UNLESS the machine was in a cycle when the power was removed. then you must decide what can happen when the power is restored. for ex. if a part was clamped and external forces were touching the part, what will happen when you start the machine back up? does the part need to remain clamped? if you unclamp the part, will it go flying out of the fixture and hurt someone?
does the system need manual controls to return the unit to its home position safely? i'm not trying to slam you in any way, just bring up my concern when you say initialize.
james
 
I have never used AOI's but the equivalent in other platforms (FB's), what I have done is pass the first scan bit & the text (or variable containing the text to the FB (AOI) so that you copy the string to the tag inside of the FB (AOI), perhaps if it is going to be fixed text then you do not need to pass it just code it in the AOI and just pass the first pass bit
So add in parameters to the FB
First_Pass_Bit
INIT_String_Val

inside the FB (AOI)
IN_Var = First_Pass
IN_Var = INIT_String

First_Pass
------| |------------[MOV INIT_String My_String]
 
@ James Mcquade
I am doing string manipulation in an AOI. Example, the AOI could produce something like this:
MM:SS where MM and SS are INT type being passed as input parameters and : is a local string in the AOI.


@ parky
I don't want to pass the string from outside into the AOI. I want to initlaize the string variable internally.; something like this:

AOI
------------------------------------

CONCAT(":", "", colonString);
...

------------------------------------
 
Last edited:
Does the S:FS bit work inside an AOI?

If not there is the prescan routine of an AOI, which is called on power up and transition from program to run.
You can read about it from page 45 on in manual 1756-PM010
 
In later versions of Logix, (somewhere around v30, from memory), you can simply MOV a constant string into a string tag.

MOV "My Tag's Default Value" Some_String_Tag
 
If the default value of a local tag isn't good enough for you then create a pre scan and if not initialized then concatenate, set the initialized tag immediately afterwards. So on first scan if not initialized it will set the default, any other time it will use the current value.
 
S:FS works if the AOI instance you’re initializing a variable in happens to be unconditionally called on the first scan of the program. This applies to nested AOI instances.

To reliably initialize variables in any AOI, under any circumstance, create a prescan routine.
 
Last edited:

Similar Topics

When you download a DB, the values get overwritten by what is in the "actual" column in offline DB. Does this happen at the start of the PLC...
Replies
6
Views
136
"Failed to Initialize the service {3F883B87-2208-11D4-B0E7-001083022E04}" Along with "Failed to load HMI Server Service" Hello, I am getting...
Replies
2
Views
700
Hello Everyone! New guy here posting first time. I'm kind of lost with this, when I open my excel file I got this error message. Any one that can...
Replies
0
Views
1,332
Hello, PLC rookie here working with an AB CompactLogix LI6ER in RSlogix 5000. So far I've only used structured text. I'm working on an...
Replies
9
Views
2,715
Hi folks, I'm new to connected components and I have some projects coming up that require it. I am trying to initialize an array I created using...
Replies
1
Views
2,389
Back
Top Bottom