Needz
Member
How would I go about writing ladder logic that would turn on an output when one of five inputs is on, any more or less and it would be off? This is using just basic XIC XIO OTE OTL and OTU instructions
0 0 0 0 0 1 1 1 2 2 3 LAMP
------[ ]----------[/]----------[/]----------[/]----------[/]----------[/]----------[/]----------[/]----------[/]----------[/]----------[/]---------( )---
| | | | | | | | | | | | | | | | | | | | | |
| 1 | | 1 | | 2 | | 3 | | 4 | | 2 | | 3 | | 4 | | 3 | | 4 | | 4 |
|---[ ]---´ `---[/]---´ `---[/]---´ `---[/]---´ `---[/]---´ `---[/]---´ `---[/]---´ `---[/]---´ `---[/]---´ `---[/]---´ `---[/]---´
| |
| 2 |
|---[ ]---´
| |
| 3 |
|---[ ]---´
| |
| 4 |
`---[ ]---´
Needz said:Would it work to have 1 input on and the other 4 inputs off on one rung with 4 OR's with all the remaining combinations of the other inputs? If so your clue helped immensely, thanks!
Steve Bailey said:It sounds like you got it.
Tark said:...Osmanmon's implementation would be the best approach. It's quick to code, less prone to coding error and easier to understand...
Lancie1 said:George, I don't want you to be disappointed that no one tried to simplify the rung.
Here is an alternate implementation for boolean enthusiasts...
Y = (x0|x1|x2|x3|x4)
& (!x0|!x1) & (!x0|!x2) & (!x0|!x3) & (!x0|!x4)
& (!x1|!x2) & (!x1|!x3) & (!x1|!x4)
& (!x2|!x3) & (!x2|!x4)
& (!x3|!x4)
0 0 0 0 0 1 1 1 2 2 3 LAMP
------[ ]----------[/]----------[/]----------[/]----------[/]----------[/]----------[/]----------[/]----------[/]----------[/]----------[/]---------( )---
| | | | | | | | | | | | | | | | | | | | | |
| 1 | | 1 | | 2 | | 3 | | 4 | | 2 | | 3 | | 4 | | 3 | | 4 | | 4 |
|---[ ]---´ `---[/]---´ `---[/]---´ `---[/]---´ `---[/]---´ `---[/]---´ `---[/]---´ `---[/]---´ `---[/]---´ `---[/]---´ `---[/]---´
| |
| 2 |
|---[ ]---´
| |
| 3 |
|---[ ]---´
| |
| 4 |
`---[ ]---´
-Trevor
12345
You mis-understand. Most of us (having done this type of problem a thousand times) saw the simple 5-branch solution right away. The only challenge in the problem was to find other not-so-obvious ways.Everyone's mind works differently but to me osmanmom's example clearly displays the intent of his logic more clearly than the people who tried to simplify the problem by using fewer contacts.
dogleg43 said:Everyone's mind works differently but to me osmanmom's example clearly displays the intent of his logic more clearly than the people who tried to simplify the problem by using fewer contacts.
I refer to these "simplified" programming examples as as "Name That Tune" programming. While using less steps or memory it is not always clearer. That's probably why I am not a professional programmer.
Just my 2 cents worth.