Automationdirect.com DirectLOGIC DL205 Series User Manual page 351

Table of Contents

Advertisement

Chapter 5: Standard RLL Instructions - Number Conversion
Binary to Real Conversion (BTOR)
1
The Binary-to-Real instruction converts a binary value in the
230
accumulator to its equivalent real number (floating point)
240
format. The result resides in the accumulator. Both the binary
2
250-1
and the real number may use all 32 bits of the accumulator.
260
3
NOTE: This instruction only works with unsigned binary, or decimal values. It will not work with signed
decimal values.
4
Discrete Bit Flags
5
SP63
SP70
6
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 BTOR instruction converts the binary
7
value in the accumulator the equivalent real number format. The binary weight of the MSB is
converted to the real number exponent by adding it to 127 (decimal). Then the remaining
bits are copied to the mantissa as shown. The value in the accumulator is copied to V1500
8
DS
Used
and V1501 using the Out Double instruction. The handheld programmer would display the
HPP Used
binary value in V1500 and V1501 as a HEX value.
9
DirectSOFT
X1
10
11
12
13
14
A
B
C
D
5–134
DL205 User Manual, 4th Edition, Rev. B
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.
LDD
V1400
Load the value in V1400 and
V1401 into the accumulator
8 4
Acc.
0 0
BTOR
Convert the binary value in
the accumulator to the real
number equivalent format
Acc.
0 1
Sign Bit
OUTD
V1500
Copy the real value in the
accumulator to V1500 and V1501
Handheld Programmer Keystrokes
$
STR
L
SHFT
ANDST
B
SHFT
GX
SHFT
OUT
Description
V1401
0
0
0
2
1
8
4 2
1
8
4
2 1
8
4
0
0
0
0 0
0
0
0
0 0
0
1
2 (exp 18)
127 + 18 = 145
145 = 128 + 16 + 1
0
0
1
0 0
0
1
0
1 0
1
1
Exponent (8 bits)
Real Number Format
4
8
A
V1501
B
ENT
1
D
D
B
E
3
3
1
4
T
O
R
ENT
1
MLR
INST#
ORN
D
B
F
A
3
1
5
0
BTOR
V1400
5
7
2
4
1
2
1
8 4
2
1
8
4 2
1
8
4
2 1
0
1
0 1
1
1
0
0 1
0
0
0
1 0
Binary Value
1
0
0 0
1
0
1
0 0
0
0
0
1 0
Mantissa (23 bits)
The real number (HEX) value
E
4
8
2
0
copied to V1500
V1500
A
A
ENT
0
0
A
ENT
0
8
4
2
1
0
0
0
1
0
0
0
0

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