61131-3
IEC:2003(E)
– 67 –
2.5.2.1 Representation
As illustrated in figure 9, an instance of a function block can be created
textually, by declaring
a data
element using the declared function block type in a VAR...END_VAR construct, identically to the use
of a structured data type, as defined in 2.4.3.
As further illustrated in figure 9, an instance of a
function block can be created graphically, by using a
graphic representation of the function block, with the function block type name inside the block, and
the instance name
above the block, following the rules for representation of functions given in 2.5.1.1.
As shown in figure 9, input and output variables of an instance of a function block can be represented
as elements of structured data types as defined in 2.3.3.1.
If either of the two graphical negation features defined in table 19 is supported for function blocks, it
shall also be supported for functions as defined in 2.5.1, and vice versa.
Graphical (FBD language)
Textual (ST language)
FF75
+------+
| SR |
%IX1---|S1 Q1|---%QX3
%IX2---|R |
+------+
VAR FF75: SR; END_VAR (* Declaration *)
FF75(S1:=%IX1, R:=%IX2); (* Invocation *)
%QX3 := FF75.Q1 ; (* Assign Output *)
MyTon
+-------+
+----+ | TON |
a--| NE |---O|EN ENO|--
b--| | r--|IN Q|O-out
+----+ --|PT ET|--
+-------+
VAR a,b,r,out : BOOL; MyTon : TON; END_VAR
MyTon(EN := NOT (a <> b),
IN := r,
NOT Q => out);
Figure 9 - Function block instantiation examples
Assignment of a value to an output variable of a function block is not allowed except from within the
function block. The assignment of a value to the input of a function block is permitted
only as part of
the invocation of the function block. Unassigned or unconnected inputs of a function block shall keep
their initialized values or the values from the latest previous invocation, if any. Allowable usages of
function block inputs and outputs are summarized in table 32, using the function block FF75 of type
SR shown in figure 9. The examples are shown in the ST language.
IEC 2479/02
Copyright International Electrotechnical Commission
Provided by IHS under license with IEC
Not for Resale
No reproduction or networking permitted without license from IHS
--``````-`-`,,`,,`,`,,`---