4 - 31 4 - 31
4 ST PROGRAM EXPRESSIONS
Precaution for acquiring the FB output
Execute FB output acquirement after an FB call. If it is executed before an FB
call, an error will occur.
Example: FB name: FB1
Input variable : I_Test
Output variable: O_Test
D1 : = FB1.O_Test;
(* FB output acquirement *)
FB1(I_Test : = D0, O_Test : = D1);
(* FB call
*)
An error occurs since this program is written in order of FB output
acquirement and FB call.
Precaution for use of I/O variables
If the result of an I/O variable is used like an output variable, an error will occur.
Like an input variable, the value of an I/O variable must be specified at the time
of an FB call.
Example: FB name: FB1
I/O variable : IO_TEST
Output variable: O_Test
[Description example]
FB1( IO_Test : = D1);
D1 : FB1.IO_Test; An error occurs.
Precaution for making an FB call
In an ST program, the FB set on the local variable setting screen can be used
only once. (If it is used more than once, an error will occur.) To use the same FB
more than once, declare the FB by the number of times it will be used
beforehand on the local variable setting screen.
Example: The following example shows that the FB label has been defined more
than once on the local variable setting screen.
In the program, the FB is used as indicated below.
label (I_Test := D0, IO_Test := D100);
label1 (I_Test := D1, IO_Test := D150);
label2 (I_Test := D3, IO_Test := D200);
Содержание MELSEC L series
Страница 1: ...Programming Manual Structured Text ...
Страница 2: ......
Страница 73: ...4 33 4 33 4 ST PROGRAM EXPRESSIONS MEMO ...
Страница 297: ......