ChrisOfMaryland
Member
I'm just getting started with ControlLogix (V17) and am trying to create a very simple Add-On instruction, using Structured Text, that increments the integer given to it, but don't seem to have the first clue how to do so, in spite of the docs and help.
First I created an Add-On Instruction with an input DINT "InputInteger" and an output DINT "OutputInteger", and wrote the following ST into it:
OutputInteger := InputInteger + 1;
Then I wrote the following lines in my main program, which has two tags, J and K, both of them DINT:
J := 7;
MakeBigger(J,K);
The idea was that K would wind up being 8. But instead it returns this error: Parameter 1: Invalid data type. Argument must match... And InputInteger, OutputInteger, J and K are all definitely DINT tags.
I also tried other ways. I hoped this would define a function that returns a value, so I could say:
K := MakeBigger(J);
but not so. It just says "Instruction not allowed in expression".
In the programming manual for add-on instructions, the examples of using an Add-On Instruction all seem to work like this:
MakeBigger(MakeBigger_ST,J,K);
where the first argument does not seem to correspond to anything inside the Add-On, and is its name plus an underscore plus an acronym for the language used to write it. But when I try this I just get "Too many arguments", and "MakeBigger_ST tag not defined".
Can anybody straighten the new guy out?
Thanks!
First I created an Add-On Instruction with an input DINT "InputInteger" and an output DINT "OutputInteger", and wrote the following ST into it:
OutputInteger := InputInteger + 1;
Then I wrote the following lines in my main program, which has two tags, J and K, both of them DINT:
J := 7;
MakeBigger(J,K);
The idea was that K would wind up being 8. But instead it returns this error: Parameter 1: Invalid data type. Argument must match... And InputInteger, OutputInteger, J and K are all definitely DINT tags.
I also tried other ways. I hoped this would define a function that returns a value, so I could say:
K := MakeBigger(J);
but not so. It just says "Instruction not allowed in expression".
In the programming manual for add-on instructions, the examples of using an Add-On Instruction all seem to work like this:
MakeBigger(MakeBigger_ST,J,K);
where the first argument does not seem to correspond to anything inside the Add-On, and is its name plus an underscore plus an acronym for the language used to write it. But when I try this I just get "Too many arguments", and "MakeBigger_ST tag not defined".
Can anybody straighten the new guy out?
Thanks!