Advanced Function Instruction
7-113
FUN130 P
MBCNT
MATRIX BIT STATUS COUNT
FUN130 P
MBCNT
Ms : Starting register of matrix
L : Matrix length
D : Register storing count results
Ms 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
2
∣
256
V、Z
P0~P9
Ms ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
L ○ ○* ○ ○
D ○ ○ ○ ○ ○ ○ ○ ○* ○* ○
z When count control "EN" = 1 or "EN↑" ( P instruction) has a transition from 0 to 1, then among the 16L bits
of the Ms matrix, this instruction will count the total amount of bits with a status of 1 (when input "1/0" = 1)
or the total amount of bits with a status of 0 (when input "1/0" = 0). The results of the counting will be stored
into the register specified by D. If the value of these amounts is 0, then the Result-is-0 flag "D = 0" will be set
to 1.
X0
EN
Ms :
R 0
130P.MBCNT
X1
1/0
L : 5
D=0
D :
R 0
z The program at left sets X1 first as 0 (to count bits with
status of 0) and then as 1 (to count bits with status of 1)
and let the signal X0 has a transition from 0
→1 for both
case, the execution results are shown at right in the
diagram below .
Ms15
↓
Ms
Ms0
↓
D
d
D
R0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R20
64
R20
16
R2
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
R3
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R4
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
X1=0
X1=1
↑
Ms79
↑
Ms64
X0=
Ö
c
Source matrix Count of ‘0’ bit Count of ‘1’ bit