Confusing Digital Voting logic Question?

MOeZ

Lifetime Supporting Member
Join Date
Nov 2009
Location
singapore
Posts
101
Hi,

I have a question to implement digital logic. these are.....I have total 8 inputs and my question is any 2 of 8 inputs is true, the output will be true. i write it down in STL and i think my STL is a bit funny? so is there any other way to implement this logic in FB and so that i can easily made 2 out of total numbers input is true......output will true?
my STL is
A(
O INPUT1
O INPUT2
)
A(
O INPUT1
O INPUT3
)
.........
.........
A(
O INPUT7
O INPUT8
)
= OUTPUT1
 
The easiest would be using a count. Zero it then have eight statements. If an input is ON then add 1 to the count. At the enc check the number. I am not sure if you mean 'at least two' or 'only two' but either way checking the total count makes this easy.
 
Try a bit hack.

I AND NOT (I-1) will return a word with only the LSB set.

N := I AND NOT (I-1)
If I >0 and I <> N then two or more bits must be set.
 

Similar Topics

I've just created a small program and saved it. Then I clicked on the 'Download to device' icon and this dialogue box appeared. Do I need to...
Replies
20
Views
1,428
Can someone help me? I am having trouble differentiating between category 3, and category 4 safety circuits. Could someone tell me what qualifies...
Replies
28
Views
15,233
Basin[1].Chain[0].Valve.Status Trying to figure out what this tag is made up of Looks like Basin[0] is a array of dints Chain[0] is an array of...
Replies
6
Views
2,658
Hello, I'm confused today. I have a pump controller that has it's own 24vdc supply and takes a 4-20ma input from a level sensor to drive a pump...
Replies
7
Views
4,513
hey everyone. Can some one please explain the addressing. I am quite new to plcs 5. can some one provide a pictographic explanation.I have read a...
Replies
12
Views
3,571
Back
Top Bottom