Standard
RLL Instructions
5–80
Standard RLL Instructions
Bit Operation Instructions
ENCO
The Encode instruction encodes the bit
position in the accumulator having a value
of 1, and returns the appropriate binary
representation. If the most significant bit is
set to 1 (Bit 31), the Encode instruction
would place the value HEX 1F (decimal
31) in the accumulator. If the value to be
encoded is 0000 or 0001, the instruction
will place a zero in the accumulator. If the
value to be encoded has more than one bit
position set to a “1”, the least significant “1”
will be encoded and SP53 will be set on.
Discrete Bit Flags Description
SP53 On when the value of the operand is larger than the accumulator can work
with.
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 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 of the accumulator is copied to V2010
using the Out instruction.
Handheld Programmer Keystrokes
DirectSOFT
LD
V2000
X1
Load the value in V2000 into
the lower 16 bits of the
accumulator
ENCO
Encode the bit position set
to “1” in the accumulator to a
5 bit binary value
00010000000000000000000000000000
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
00000000000011000000000000000000
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
V2000
1000
Bit postion 12 is
converted
to binary
Copy the value in the lower 16 bits
of the accumulator to V2010
OUT
V2010
V2010
000C
Binary value
for 12.
STR
$
1
B
ENT
SHFT
OUT
GX
SHFT
AND
V
2
C
0
A
1
B
0
A
ENT
4
E
TMR
N
2
C
INST#
O
ENT
SHFT
ANDST
L
3
D
2
C
0
A
0
A
0
A
ENT
Encode
(ENCO)