[?]: How to count number of bits?

RSLinx, RSLogix, RSView, LogixPro ...
Scarch
Posts: 103
Joined: Fri Aug 31, 2007 8:17 pm
Location: Europe

[?]: How to count number of bits?

Post by Scarch »

The PLC is an L33ER.
I have 48 bits to be enabled/disabled from an operator panel.
I need to know how many of them are set to one.
Every bit means a machine, but they can be different.
For example, I set only the machines 1 to 8 to ON, so I have 8 machines enabled. But I can also set the machines 40, 2, 24, 35, 11, 12, 44 and 1 to ON, getting the same result (8 machines enabled).
I have no idea, please help.

Thanks a lot
Schtiel
Site Admin
Posts: 1122
Joined: Wed Sep 06, 2006 12:03 pm
Location: CIS

Re: [?]: How to count number of bits?

Post by Schtiel »

May be File Bit Comparison (FBC) instruction will help. See this thread.