![FATEK FBs Series Скачать руководство пользователя страница 199](http://html1.mh-extra.com/html/fatek/fbs-series/fbs-series_manual_3764826199.webp)
Advanced Function Instruction
7 -3 5
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
V
、
Z
P0~P9
S
○
○
○
○
○
○
○
○
○
○
○
○
○
N
S
○
○
○
○
○
○
○
○
○
○
○
○
0
~
15
○
N
L
○
○
○
○
○
○
○
○
○
○
○
○
2
~
256
○
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
~
B
N
S
+N
L
−
1 (B
N
S
is called the encoding start point, and its relative bit number is b0;B
N
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 0 0 0 1 S
High
Total
N
L
discrete points
Low
High priority search direction
Ø
Low priority search direction
D
0 0 0 0 0 0 0 0
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. b0
~
bN
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.
Содержание FBs Series
Страница 78: ...MEMO ...
Страница 111: ...4 6 X0 X1 Node A Y0 Y1 Node B differential down Incerse differential up t Scan time Inverse t t ...
Страница 141: ...Basic Function Instruction 6 16 FUN 2 SKP SKIP START FUN 2 SKP Y2 Y1 Y0 T201 10S X0 X1 X2 0 10 0 ...
Страница 305: ...MEMO ...
Страница 348: ...MEMO ...