Automationdirect.com DirectLOGIC DL205 Series User Manual page 352

Table of Contents

Advertisement

Real to Binary Conversion (RTOB)
The Real-to-Binary instruction converts the real number in
230
the accumulator to a binary value. The result resides in the
240
accumulator. Both the binary and the real number may use all
250-1
32 bits of the accumulator.
260
NOTE
: The decimal portion of the result will be rounded down (14.1
1
NOTE
: If the real number is negative, it becomes a signed decimal value.
2
Discrete Bit Flags
SP63
SP70
SP72
SP73
SP75
In the following example, when X1 is on, the value in V1400 and V1401 is loaded into the
accumulator using the Load Double instruction. The RTOB instruction converts the real
value in the accumulator the equivalent binary number format. The value in the accumulator
DS
Used
is copied to V1500 and V1501 using the Out Double instruction. The handheld programmer
HPP Used
would display the binary value in V1500 and V1501 as a HEX value.
DirectSOFT
X1
LDD
V1400
Load the value in V1400 and
V1401 into the accumulator
RTOB
Convert the real number in
the accumulator to binary
format.
OUTD
V1500
Copy the real value in the
accumulator to V1500 and V1501
Chapter 5: Standard RLL Instructions - Number Conversion
On when the result of the instruction causes the value in the accumulator to be zero.
On anytime the value in the accumulator is negative.
On anytime the value in the accumulator is a valid floating point number.
On when a signed addition or subtraction results in an incorrect sign bit.
On when a number cannot be converted to binary.
Sign Bit
Exponent (8 bits)
Acc.
0 1
0 0 1
0 0
0 1 0 1 0
128 + 16 + 1 = 145
127 + 18 = 145
2 (exp 18)
8 4
2 1 8
4 2
1 8
Acc.
0 0
0 0 0
0 0
0 0 0 0 0
Handheld Programmer Keystrokes
$
B
ENT
STR
1
L
D
D
SHFT
ANDST
3
3
R
T
O
B
SHFT
ORN
MLR
INST#
1
GX
D
B
SHFT
OUT
3
1
DL205 User Manual, 4th Edition, Rev. B
14 or - 14.1
Description
4 8
A
E
4
8
2
0
Real Number Format
V1401
V1400
Mantissa (23 bits)
1 1 1 0
0 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0
Binary Value
4 2 1
8 4
2 1
8 4
2 1
8 4
0 1 0 1
0 1 1 1 0 0 1 0 0 0 1 0 0 0 0 1
V1501
V1500
0 0
0
5
7
2
4
1
The binary number copied to V1400
B
E
A
A
ENT
1
4
0
0
ENT
F
A
A
ENT
5
0
0
RTOB
-15).
2 1 8
4 2
1 8
4 2 1
5–135
1
2
3
4
5
6
7
8
9
10
11
12
13
14
A
B
C
D

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