4 - 4 4 - 4
4 ST PROGRAM EXPRESSIONS
4.2.2 Examples of using the operators
The following gives the examples of using the operators in ST programs.
(1) Operation of integer type (INT)
(a) When actual devices are used
[Example of use]
D0 : = D1 * (D2 + K3) / K100;
<<Operation order>>
1) D2 + K3
2) (D2 + K3) * D1
3) (D2 + K3) * D1 / K100
4) The result of 3) is assigned to D0.
(b) When labels are used
When word type labels Dtest1, Dtest2 are used
[Example of use]
Dtest2 : = Dtest1 MOD (D2 + K3) * K100;
<<Operation order>>
1) D2 + K3
2) Dtest1 MOD (D2 + K3)
3) Dtest1 MOD (D2 + K3) * K100
4) The result of 3) is assigned to Dtest2.
When double word type labels Dwtest1, Dwtest2 are used
[Example of use]
Dwtest2 : = Dwtest1 - Dwtest1 / K100;
<<Operation order>>
1) Dwtest1 / K100
2) Dwtest1 - Dwtest1 / K100
3) The result of 2) is assigned to Dwtest2.
Precautions when an operation result exceeds the data type range
When an operation result exceeds the data type range, correct result cannot
be obtained.
For data type range, refer to Section 3.2.1.
Содержание MELSEC L series
Страница 1: ...Programming Manual Structured Text ...
Страница 2: ......
Страница 73: ...4 33 4 33 4 ST PROGRAM EXPRESSIONS MEMO ...
Страница 297: ......