2-29
Section 2 Programming Languages
(2) Describing a function block in the IL language
When describing a function block call in the IL language, it is necessary to specify input/output parameters and a call
instruction (“CAL,” “CALC,” or “CALCN”) as shown below.
<Sample program for calling an up counter FB (CTU_1)>
LD INPUT1 (* Count input *)
ST
CTU_1.CU
INPUT2 (* Reset input *)
CTU_1.RESET
SETDATA (* Set value *)
CTU_1.PV
L CTU_1 (* Read CTU_1 unconditionally *)
CTU_1.Q
OUTFLAG (* Up bit *)
CTU_1.CV
ST CURRENT (* Current value *)
Passes input parameters.
Passes output parameters.
Calls the function block.
(3) Describing a function block in the ST language
Specify a function block call in the ST language as shown below.
<Sample program for calling an up counter FB (CTU_1)>
CTU_1(CU: =INPUT1, RESET: =INPUT2, PT: =SETDATA);
OUTFLAG: =CTU_1.Q;
CURRENT: =CTU_1.CV
Passes output parameters.