EasyManua.ls Logo

FATEK FBs-CB2 - DECODE (FUN 57 DECOD)

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-34
FUN 57 P
DECOD
DECODE
FUN 57 P
DECOD
S :
D :
ENDecode control
Ladder symbol
57P.DECOD
Ns :
ERR Range error
N :
L
S : Source data register to be decoded
(16 bits)
N
S
: Starting bits to be decoded within S
N
L
: Length of decoded value (1~8 bits)
D : Starting register storing decoded results
(2~256 points = 1~16 words)
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
18
D * *
This instruction, will set a single bit among the total of 2
N
L
discrete points (D) to 1 and the others bit are set to
0. The bit number to be set to 1 is specified by the value comprised by B
N
S
BN
S
+N
L
1 of Swhich is called
the decode value, B
N
S
is the starting bit of the decode value, and BN
S
+N
L
1 is the end value,.
When decode control "EN" = 1 or "EN" ( P instruction) has a transition from 0 to 1, will take out the value
B
N
S
BN
S
+N
L
1 from S. And with this value to locate the bit position and set D accordingly, and set all the
other bit to zero
This instruction only provides 16 bit operand, which means S only has B0~B15. Therefore the effective range
of Ns is 0~15, and the N
L
length of the decode value is limited to 1~8 bits. Therefore the width of the decoded
result D is 2
18
points = 2~256 points = 1~16 words (if 16 points are not sufficient, 1 word is still occupied). If
the value of N
S
or N
L
is beyond the above range, will set the range-error flag "ERR" to 1, and do not carry out
this instruction.
If the end bit value exceeds the B15 of S, then will extend toward B0 of S + 1. However if this occurs then
S+1 can’t exceed the range of specific type of operand (ie. If S is of D type register then S+1 can’t be D3072).
If violate this, then this instruction only takes out the bits from starting bit B
Ns to its highest limit as the decode
value.
X0
EN
S :
Ns :
3
R 2
57P.DECOD
ERR
D :
WX 0
NL :
5
z The instruction at left takes out the data of five
successive bits from X3 to X7 within the WX0
register and decodes it. The results are then stored
in the 32-bit register starting at R2.
X15 X7 X3 X0
S001100000 1 0 0 1 1 1 0
Length of decode value N
L
=5,so bit value is formed by X7~X3 (equal 9)
Ø
X0
R3 R2
D 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
B31 B9 B0
Because N
L
=5,the width of D is 2
5
= 32 point = 2 word. That is, D is formed by R3R2, and the decoded value is
01001=9, therefore B9 (the 10th point) within D is set to 1, and all other points are 0.

Other manuals for FATEK FBs-CB2

Related product manuals