Chapter 6 Instruction Details
XBC E-Type Main Unit 6-111 Ve r. 1
6.21.3 R2I, R2IP, R2D, R2DP
Instruction
Step
P M K F L T C S Z D.x
U N D R
2~4 O - -
Area Number where Real number is saved, or Real number
Device Position to save data converted to Real Data Format
[Flag Set]
Flag Description Device Number
Error
When R2I Instruction used and S specified Single Real Number is out of
-32,768~32,767 range.
When R2D Instruction used and S specified Single Real Number is out of
-2,147,483,648 ~2,147,483,647 range.
F110
1) R2I (Real to Integer)
(1) R2I converts S+1,S specified Real Number(32-bit) to 16-bit Integer data to save in D.
(12345.678)
S+1, S
b15
b0
hE6B6
h4640
b31
h303A
(12346)
b0b15
D
(2) If S+1,S specified Real Number value exceeds -32,768~32,767 range, operation error occurs.
The result of 32,767 will be saved if input value is bigger than 32,767, and -32,768 will be saved if input value
is smaller than -32,768.
(3) Value of below decimals will be omitted after rounding off the nearest integer.
2) R2D (Real to Double Integer)
(1) R2D converts S+1,S specified 32-bit Integer data to Long Real Number(32-bit) and saves in D+1,D.
(123456.78)
S+1, S
b15
b0
h2065
h47F1
b31
(123457)
b0b15
D+1, D
h0001
hE241
b31
(2) If S+1,S specified Real Number’s value exceeds -2,147,483,648~2,147,483,647 range, operation error
occurs. The result of 2,147,483,647 will be saved if Real value is bigger than 2,147,483,647, and -
2,147,483,648 will be saved if Real value is smaller than -2,147,483,648.
(3) Value of below decimals is will be omitted after rounding off the nearest integer.