2-5
Section 2 Programming Languages
(2) Describing a function in the IL language
To describe a function call in the IL language, specify, as the rst input, the current operation result and, as the operator, the
function call instruction (function name) that species the second and subsequent inputs as operands.
1) 1-input function
LD “Input”
SQRT
ST “Area for storing operation result”
2) 2-input function
LD “First input”
SHL_WORD “Second input”
ST “Area for storing operation result”
3) 3-input function
LD “First input”
SEL “Second input,” “Third input”
ST “Area for storing operation result”
Notes:
You cannot specify, in the IL language, any function that has the same mnemonic as an IL instruction (e.g. ADD).
Instructions such as “ADD” must always have two xed inputs when they are to be used in the IL language.
ADD
IN1
IN2
IN3
IN4
IN5
LD IN1
ADD IN2
ADD IN3
ADD IN4
ADD IN5
ST OUT
OUT
<Representation in FBD or LD language> <Representation in IL language>
(3) Describing a function in the ST language
1) 1-input function
“Area for storing operation result” := SQRT (“Input”);
2) 2-input function
“Area for storing operation result” := SHL_WORD (“First input,” “Second input”);
3) 3-input function
“Area for storing operation result” := SEL (“First input,” “Second input,” “Third input”);