DL205 User Manual, 4th Edition, Rev. B
5–264
Chapter 5: Intelligent Box (IBox) Instructions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
A
B
C
D
Real to Double BCD with Implied Decimal Point and Rounding (RTOBCDD)
(IB-563)
Real to Double BCD with Implied Decimal
Point and Rounding converts the absolute
value of the given Real number to an 8-digit
DWORD BCD number, compensating for
an implied number of decimal points (K0-
K8) and performs rounding.
For example, RTOBCDD R38156.74 with
an implied number of decimal points equal
to K1, would yield 381567 BCD. If the
implied number of decimal points was 0,
then the function would yield 38157 BCD
(note that it rounded up).
If the Real number is negative, the Result will equal its positive, absolute value.
RTOBCDD Parameters
• Value (DWORD Real): specifies the Dword Real number that will be converted and rounded to a
BCD number with decimal points
• Number of Decimal Points: specifies the number of implied decimal points in the Result DWORD
• Result (DWORD BCD): specifies the location where the rounded/implied decimal points
DWORD BCD value will be placed
RTOBCDD Example
In the following example, the RTOBCDD instruction is used to convert the 32-bit REAL
(floating point) data format in V3000 and V3001 to the 8-digit BCD data format and store
in V2000 and V2001 when C100 turns on.
K2 in the Number of Decimal Points implies the data will have two implied decimal points.
DS5
Used
HPP
N/A
Parameter
DL205 Range
Value (DWORD Real) . . . . . . . . . . . . . . . . . V,P,R
R ; See DL205 V-memory map - Data Words
Number of Decimal Points . . . . . . . . . . . . . . . K
K0-8
Result (DWORD BCD) . . . . . . . . . . . . . . . . . . . . V
See DL205 V-memory map - Data Words
ý
ý
þ
þ
230
240
2
5
0
-1
2
6
0