counting bits in a byte and putting rusult in a real

ISL_MAN

Member
Join Date
Aug 2005
Location
rOTHERHAM
Posts
20
I'm having a mental block this morning. Want to do something very simple. I've got a number of enable bits in a byte and I've got a real which I want to display the number of bits set in this byte. I'm trying to do this in S7 300 Ladder logic.
 
If it must be ladder then here you go...

(but you'll find the code becomes much more compact/elegant if you learn to use STL)
 

Similar Topics

Hello! I have an application where I can only have 3 pumps running out of 6. I load the pumpRunning bits into an array. What I need to do is...
Replies
6
Views
3,131
Hello, I am in need of a solution to a problem I've failed to come up with a solution to that doesn't take entirely too long for my needs. I...
Replies
40
Views
15,715
This may be a foolish question, but is their a simple way to count the number of active bits in PLC-5? I can think of some complex ways to do...
Replies
8
Views
5,506
Happy New Year all! Does anyone have a good method for counting the bits that are 1 (on) in a single word, using Rockwell RSLogix500. I have a...
Replies
8
Views
12,061
I have 4 bits B3:0/0 thru B3:0/3 that each represent a unit being on. I want to count the number of bits set to one and return an integer between...
Replies
2
Views
3,662
Back
Top Bottom