Examples Of Using The Operators - Mitsubishi Electric MELSEC Q Series Programming Manual

Structured text
Hide thumbs Also See for MELSEC Q Series:
Table of Contents

Advertisement

4 ST PROGRAM EXPRESSIONS

4.2.2 Examples of using the operators

4 - 4
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.
4 - 4

Advertisement

Table of Contents
loading

This manual is also suitable for:

Melsec l series

Table of Contents