3. Instruction Set
API
Mnemonic Operands Function
129 D
INT P
Float to integer
Type
OP
Bit Devices Word devices Program Steps
X Y M S K H KnX
KnY
KnM
KnS
T C D E F
INT, INTP: 5 steps
DINT, DINTP: 9 steps
SS2
SX2
SS2
SX2
SS2
SX2
Operands:
S: Source device D: Operation result
Explanations:
1. The binary floating point value in the register S is converted to BIN integer and stored in register
D. The decimal of the operation result will be left out.
2. This instruction is the opposite of the API 49 (FLT) instruction.
3. Flags: M1020 (Zero flag), M1021 (Borrow flag) and M1022 (Carry flag).
If the conversion result is 0, zero flag M1020 = ON.
If there is any decimal left out, borrow flag M1021 = ON.
If the conversion result is larger than the below range, carry flag M1022 = ON
16-bit instruction: -32,768 ~ 32,767
32-bit instruction: -2,147,483,648 ~ 2,147,483,647
Program Example:
1. When X0 = ON, the binary floating point value of (D1, D0) will be converted to BIN integer and
the result is stored in D10. The decimal of the result will be left out.
2. When X1 = ON, the binary floating point value of (D21, D20) will be converted to BIN integer
and the result is stored in (D31, D30). The decimal of the result will be left out.