Automationdirect.com DirectLOGIC DL205 Series User Manual page 480

Table of Contents

Advertisement

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

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the DirectLOGIC DL205 Series and is the answer not in the manual?

Table of Contents

Save PDF