6F3B0250
220
T1/T1S User’s Manual
7. Instructions
FUN 122
BC
Bit count
Expression
Input
-
[
A
BC
B
]
-
Output
Function
When the input is ON, this instruction counts the number of ON (1) bits of
A, and stores the result in B.
Execution condition
Input
Operation
Output
OFF
No execution
OFF
ON
Execution
ON
Operand
Name
Device
Register
Constant Index
X
Y
R
S
T.
C. XW YW RW SW
T
C
D
I
J
K
A
Source
Ö
Ö
Ö
Ö
Ö
Ö
Ö
Ö
Ö
Ö
Ö
B
Count data
Ö
Ö
Ö
Ö
Ö
Ö
Example
When R020 is ON, the number of ON (1) bits of the register RW032 is counted, and the result is
stored in D0102.
The following figure shows an operation example.
F
E D C B A
9
8
7
6
5
4
3
2
1
0
RW032 0 0 1 0 0 1 1 1 0 1 0 1 1 0 0 0
Counts the number of ON (1) bits = 7
F
E D C B A
9
8
7
6
5
4
3
2
1
0
D0102
0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1
The result data (7) is stored in binary
T1S only
CTi Automation - Phone: 800.894.0412 - Fax: 208.368.0415 - Web: www.ctiautomation.net - Email: [email protected]