Bitcnt - Omron NY532-5400 Reference Manual

Ny-series
Hide thumbs Also See for NY532-5400:
Table of Contents

Advertisement

2 Instruction Descriptions

BitCnt

The BitCnt instruction counts the number of TRUE bits in a bit string.
Instruction
BitCnt
Bit Counter
Variables
Name
Meaning
In
Count
string
Out
Count
result
* If you omit the input parameter, the default value is not applied. A building error will occur.
Bit strings
In
OK OK OK OK
Out
Function
The BitCnt instruction counts the number of TRUE bits in count string In. The following example is for
when In is BYTE data with a value of BYTE#16#85.
LD
BYTE#16#85
In 1 0 0 0 1 0 0 1
3
Out = abc
2-412
Name
FB/FUN
FUN
I/O
Description
Input
String in which to count
TRUE bits
Output
Number of TRUE bits
OK
BitCnt
EN
ENO
abc
In
The number of TRUE (1) bits is counted.
Graphic expression
(@)BitCnt
EN
ENO
In
Out
Valid range
Depends on data type.
0 to No. of bits in In
Integers
ST
abc:=BitCnt(BYTE#16#85);
NY-series Instructions Reference Manual (W560)
ST expression
Out:=BitCnt(In);
Unit
Default
---
*
---
---
Times, durations,
dates, and text strings

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents