EasyManua.ls Logo

FATEK FBs-CB2 - ENCODE (FUN 58 ENCOD)

FATEK FBs-CB2
348 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Advanced Function Instruction
7-35
FUN 58 P
ENCOD
ENCODE
FUN 58 P
ENCOD
S : Starting register to be encoded
N
S
: Bit position within S as the encoding start
point
N
L
: Number of encoding discrete points (2~256)
D : Number of register storing encoding results
(1 word)
S, N
S
, N
L
, D may combine with V, Z, P0~P9 to
serve indirect address application
WX WY WM WS TMR CTR HR IR OR SR ROR DR K XR Range
Ope-
rand
WX0
WX240
WY0
WY240
WM0
WM1896
WS0
WS984
T0
T255
C0
C255
R0
R3839
R3840
R3903
R3904
R3967
R3968
R4167
R5000
R8071
D0
D4095
16-bit
+/-
number
VZ
P0~P9
S
N
S
015
N
L
2256
D * *
When encode control "EN" = 1 or "EN" ( P instruction) has a transition from 0 to 1, will starting from the
points specified by Ns within S, take out towards the left (high position direction) N
L
number of successive bits
B
N
S
BN
S
+N
L
1 (BN
S
is called the encoding start point, and its relative bit number is b0;BN
S
+N
L
1 is called
the encoding end point, and its relative bit number is B
N
L
-1). From left to right do higher priority (when H/L=1)
encoding or from right to left do lower priority (when H/L=0) encoding (i.e. seek the first bit with the value of 1,
and the relative bit number of this point will be stored into the low byte (B0~B7) of encoded resultant register
D, and the high byte of D will be filled with 0.
b
N
L
1 b
H
b
L
b
0
)← Relative bit number
B
N
S
N
L
1 BN
S
B15
B1 B0
Direction of extension 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0001 S
High Total N
L
discrete points Low
High priority search direction Ø Low priority search direction
D 00000000 H or L
As shown in the diagram above, for high priority encoding, the bit first to find is b
H
(with a value of 12), and for
low priority encoding, the bit first to find b
L
(with a value of 4). Among the N
L
discrete points there must be at
least one bit with value of 1. If all bits are 0, will not to carry out this instruction, and the all zero flag "D=0" will
set to 1.
Because S is a 16-bit register, Ns can be 0~15, and is used to assign a point of B0~B15 within S as the
encoding start point (b0). The value of N
L
can be 2~256, and it is used to identify the encoding end point, i.e. it
assigns N
L
successive single points starting from the start point (b0) towards the left (high position direction)
as the encoding zone (i.e. b0bN
L
1). If the value of Ns or NL exceeds the above value, then do not carry out
this instruction, and set the range-error flag "ERR" as 1.

Other manuals for FATEK FBs-CB2

Related product manuals