Detect More Than One Active Bit

toddster900

Member
Join Date
Oct 2011
Location
England
Posts
35
Hi All

I have x number of bits representing an active state on x number of valves and I want to be able to detect when more than one valve is active.

I would like to be able to do this in ladder logic and despite thinking it would be quite simple have not managed to find a simple and clean way of doing this.

I can obviously use a long list of two bit branches to cover all the combinations of two active valves but I fell I am missing a far simpler solution.

If I move the active bits into a word can anyone think of a way to easily detect if more than bit in that word is on? Any other ideas also very welcome.

Thanks
 
Lare - This is being done in Unity Pro on an M580 but I would like to try and get a solution that would be universal.

Geoff - This solution had crossed my mind. I would prefer that the logic be done in ladder and this would require a count up rung for every valve. My first thoughts were there should be a more elegant solution but possibly not.
 
On unity I would make array of bools or ebools.
Then copy all valve bits to this array.

For counting bits which are on, you can do with looping whole array on IL/ST or sum_arr commands. (sum_arr works with ints and dints, so you can use copy arr_bool -> arr_int first)

And if you need to search which valve have bit on, then you can use search arr commands.


p.s Looping with bool is maybe easier, then you can copy index-value to consecutive words, when bit on "1" state is founded.
 
Last edited:
You can do it in ladder easily enough. It's just hard work typing ladder in a text box.

There is no need for counters just use an add.
 
Thanks for all the input! I think I am just going to use add instructions for now but there is some interesting reading there.
 

Similar Topics

Does anyone know of a way to detect if someone is online with the controller in ControlLogix (from logic) I'm thinking that maybe there is a CIP...
Replies
7
Views
291
Hi all, I am trying to find a way of detecting a motor is not isolated before attempting to run an inverter. We would normally use a 4 pole...
Replies
19
Views
2,931
Hello everybody, I have a vendor system that has some remote monitoring (read only) and remote control (read/write) data that is available via...
Replies
7
Views
2,804
Replies
1
Views
1,203
Hello.We are using S7-300 Cpu.Sometimes give an error.OB86 and OB122 blocks called.OB86 Block ; L #OB86_FLT_ID T...
Replies
7
Views
1,848
Back
Top Bottom