6F3B0250

7. Instructions

FUN 122

BC

Bit count

Expression

Input -[ A BC B ]- Output

Function

T1S only

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.

RW032

D0102

F E D C B A 9 8 7 6 5 4 3 2 1 0

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

0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1

The result data (7) is stored in binary

220 T1/T1S User’s Manual

CTi Automation - Phone: 800.894.0412 - Fax: 208.368.0415 - Web: www.ctiautomation.net - Email: info@ctiautomation.net

Page 222
Image 222
Toshiba PROSEC T1 T1S, 6F3B0250 user manual FUN Bit count, T1S only