3. Instruction Set
3-423
API Mnemonic Operands Function
190
MBC P
Matrix bit status count
Controllers
ES2/EX2 SS2 SA2
SE
SX2
Bit Devices Word devices Program Steps Type
OP
X Y M S K H KnX KnY KnM KnS T C D E F
S * * * * * * *
n * * *
D * * * * * ***
MBC, MBCP: 7 steps
PULSE 16-bit 32-bit
ES2/EX2 SS2
SA2
SE
SX2 ES2/EX2 SS2
SA2
SE
SX2 ES2/EX2 SS2
SA2
SE
SX2
Operands:
S: Matrix source device n: Matrix length (K1~K256) D: Operation result
Explanations:
1. MBC instruction counts the number of bit 1 or bit 0 in the matrix with matrix length n and
stores the counted number in D.
2. If operands S or D use KnX, KnY, KnM, KnS format, only n = 4 is applicable.
3. When M1098 = ON, MBC instruction counts the number of bit 1. M1098 = OFF, MBC counts
the number of bit 0. If bits counting result is 0, M1099 = ON
4. Associated flags:
M1098: Counting the number of bits which are “1” or “0”
M1099: ON when the bits counting result is “0”..
Program Example:
When X0 = ON with M1098 = ON, MBC instruction counts the number of bit 1 in D0~D2 and store
the counted number in D10. When X0 = ON with M1098 = OFF, the instruction counts the number
of bit 0 in D0~D2 and store the counted number in D10.
X0
MBC D0 K3 D10
11111 101
11111 1010
11111 1010
0
12
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
0
0
0
0
M1098=0
36
M1098=1
D0
D1
D2
D10
D10