Add-On Instruction Execution

ASF

Lifetime Supporting Member
Join Date
Jun 2012
Location
Australia
Posts
3,921
Hi all,

Just wondering if anyone knows enough about the inner workings of an add-on instruction to answer this question for me:

Does the AOI update it's own inputs and outputs synchronously, or asynchronously?

By which I mean, does the AOI act like an SLC or MicroLogix, in that it
1. Reads inputs
2. Executes code
3. Writes outputs

or does it operate more like a Compact Logix, where inputs could be updated midway through the code, and outputs are updated immediately as they are changed in the code?

My situation is this: I'm writing an AOI which does some sampling of a process variable, and I want to take a certain number of samples and store them in an array. The number of samples is an input parameter can could be changed by a programmer accessing the "faceplate" of the AOI from within the main code, or an operator using a HMI. My array is of a fixed size, and so the first thing I do in the AOI is to use a standard GRT MOV pair to limit the "samples" input to the size of my array. This is all well and good, but what I'm not sure of is, if programmer or operator changes the "samples" input parameter to too high a number while the AOI is partway through executing the code - after my limiting logic, but before it's used as an array pointer - will the "samples" value be updated immediately, and used at it's too high value for the remainder of the logic? Or is it checked at the start of the AOI and not updated again until the next call?
 
I would think that peripheral servicing (HMI/PLC software) would be synchronous.
Also, your AOI is only services synchronously, so even if you pass in the IO value as an input, it is still only evaluated each scan even if it is updated asynchronously.

As I understand it anyways...
 
It depends on whether to pass the parameter as an INPUT or an IN/OUT. As far as I know, INPUTs become a mapped assignment to data assigned to the AOI. So once the AOI is executed and the parameter assignment is made, changed to the base data external to the AOI will have no effect on the data data internal to the AOI.

IN/OUT parameters are accessed by reference. Basically the AOI is passed a pointer to the location of the IN/OUT parameter at AOI execution. No specific assignment is made. So it is possible for an IN/OUT data item to be changed external to an AOI during AOI execution.

Keith
 
Keith, do you have anything to back up what you're saying? Not that I don't trust you of course! I just always like to know why I know things :)

The parameter in this case is an INPUT parameter, and is visible but not required. So I don't have an external tag connected to it whose value could change. But a programmer could still change the value in the AOI faceplate at any point in the scan cycle. For example, below is a snippet of my DOL motor add on instruction. At any point during the scan cycle, I could while online double click on the "2000" representing the AtSpeedTime and change it. If I did so while the code was between references inside the AOI, do you know whether the AOI would use the updated value from that point on, or only once the AOI is called again with the different parameter on the next scan?

Screen Shot 2016-01-12 at 8.21.26 am.png
 
Originally posted by ASF:

Keith, do you have anything to back up what you're saying? Not that I don't trust you of course! I just always like to know why I know things

The IN vs. IN/OUT thing is based on this thread:

http://www.plctalk.net/qanda/showthread.php?t=30489

As long as is is an INPUT parameter the value is only copied in when the instruction begins execution. So you are "protected" from changes during the AOI execution.

Keith
 
Aha! That's exactly what I was after, thanks Keith!

Just to close the loop, this document contains the attached table on page 30, which confirms exactly what Keith says above.

Screen Shot 2016-01-12 at 10.55.55 am.jpg
 

Similar Topics

hey good afternoon ! I have a simple question, I need to import an Add on instruction to a controller that is in operation and cannot stop. Is it...
Replies
6
Views
321
please can someone help me how do i add status bits to the add on instruction in studio 5000 thank you
Replies
2
Views
1,492
Hello all, Is there a way to trend tags associated with AOI? Currently the selection is grayed out. The tag is a local tag and it resides in a...
Replies
8
Views
2,160
I have to create a sample mov template in add on instruction.I just want to know the list of tags which is used to create a mov logic instruction...
Replies
6
Views
2,107
I know this sounds really stupid, but I have a function block program I have written and have been debugging. I have an ADD block that will not...
Replies
10
Views
2,395
Back
Top Bottom