Automationdirect.com DirectLOGIC DL205 Series User Manual page 345

Table of Contents

Advertisement

Chapter 5: Standard RLL Instructions - Bit Operation
Encode (ENCO)
1
The Encode instruction encodes the bit position in the
230
accumulator having a value of 1, and returns the appropriate
240
binary representation. If the most significant bit is set to 1 (Bit
2
250-1
31), the Encode instruction would place the value HEX 1F
(decimal 31) in the accumulator. If the value to be encoded is
260
3
0000 or 0001, the instruction will place a zero in the
accumulator. If the value to be encoded has more than one bit
DS
Used
position set to a "1", the least significant "1" will be encoded
4
HPP Used
and SP53 will be set on.
Discrete Bit Flags
5
SP53
6
NOTE: The status flags are only valid until another instruction that uses the same flags is executed.
In the following example, when X1 is on, The value in V2000 is loaded into the accumulator
7
using the Load instruction. The bit position set to a "1" in the accumulator is encoded to the
corresponding 5 bit binary value using the Encode instruction. The value in the lower 16 bits
8
of the accumulator is copied to V2010 using the Out instruction.
9
DirectSOFT
10
X1
LD
Load the value in V2000 into
the lower 16 bits of the
11
accumulator
12
ENCO
13
Encode the bit position set
to "1" in the accumulator to a
5 bit binary value
14
A
OUT
Copy the value in the lower 16 bits
of the accumulator to V2010
B
C
D
5–128
DL205 User Manual, 4th Edition, Rev. B
On when the value of the operand is larger than the accumulator can work with.
V2000
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
0
V2010
Handheld Programmer Keystrokes
$
STR
L
SHFT
ANDST
E
SHFT
GX
OUT
Description
0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
B
ENT
1
D
C
A
3
2
0
N
C
O
ENT
4
TMR
2
INST#
V
C
A
SHFT
AND
2
0
ENCO
V2000
1
0
0
0
15 14 13 12 11 10 9 8 7 6 5
0 0 0 1 0 0 0 0 0 0 0 0 0 0
Bit postion 12 is
converted
to binary
15 14 13 12 11 10 9 8 7 6 5
0 0 0 0 0 0 0 0 0 0 0 0 1 1
0
0
0
V2010
A
A
ENT
0
0
B
A
ENT
1
0
4 3 2 1 0
0 0
4 3 2 1 0
0 0
C
Binary value
for 12.

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