trellend
Industrial
- Aug 4, 2015
- 18
I'm trying to drive an LED so that it shows 3 different states.
This thing goes in a circle, and there is a limit switch at the bottom. (Hydraulic motor spins a gear) When you press Start (X1), the motor runs (Y1) until the limit switch (X2) is hit again. (Can't use rising because of bouncy switches, timing is such that a 50 ms debounce makes stopping at the right spot impossible (Sensor location)). But when you press start, the sensor is active for a while, so I set a timer for 1.5secs (T1) to set a bit (C1) so that it only Stops again when both the Timer expired and it hits the limit switch. I didn't design the mechanics of this.
The LED (Y2) is labeled "Home"
1. When nothing is happening, and it's at HOME position, I want the LED On
2. When you press the button, I want the LED flashing while it's still Home, but moving away.
3. After it clears HOME, I want the LED off.
4. When it hits HOME again, it stops, repeat to step one.
I can write this, but I get warnings "multiple rungs are setting the same output". I prefer to have no warnings.
Can that be done in one rung with multiple rows, or must I use control bits and only have one set command?
Pseudo code:
if (IGNORESENSOR) {
LED = (HOME AND FLASHERBIT);
} else {
LED = HOME;
}
The problem for me is that IF, not used to ladder logic.
--[/IGNORE]--------------------------(LED)
-[HOME]--|
--[IGNORE]------------[FLASHERBIT]---(LED)
I'm not on site to test that. I'm looking for opinions...
And I can't press the button to test unless it's in operation, press it twice without a full cycle, 30 minutes downtime for repairs.
States:
1. Motor/Drive (Y1) is off, Sensor is at HOME (X2), LED status: ON
2. Motor/Drive (Y1) is ON, Sensor is at HOME (X2), IgnoreHomeSensor (C1) ON LED status: Flashing
3. Motor/Drive
This thing goes in a circle, and there is a limit switch at the bottom. (Hydraulic motor spins a gear) When you press Start (X1), the motor runs (Y1) until the limit switch (X2) is hit again. (Can't use rising because of bouncy switches, timing is such that a 50 ms debounce makes stopping at the right spot impossible (Sensor location)). But when you press start, the sensor is active for a while, so I set a timer for 1.5secs (T1) to set a bit (C1) so that it only Stops again when both the Timer expired and it hits the limit switch. I didn't design the mechanics of this.
The LED (Y2) is labeled "Home"
1. When nothing is happening, and it's at HOME position, I want the LED On
2. When you press the button, I want the LED flashing while it's still Home, but moving away.
3. After it clears HOME, I want the LED off.
4. When it hits HOME again, it stops, repeat to step one.
I can write this, but I get warnings "multiple rungs are setting the same output". I prefer to have no warnings.
Can that be done in one rung with multiple rows, or must I use control bits and only have one set command?
Pseudo code:
if (IGNORESENSOR) {
LED = (HOME AND FLASHERBIT);
} else {
LED = HOME;
}
The problem for me is that IF, not used to ladder logic.
--[/IGNORE]--------------------------(LED)
-[HOME]--|
--[IGNORE]------------[FLASHERBIT]---(LED)
I'm not on site to test that. I'm looking for opinions...
And I can't press the button to test unless it's in operation, press it twice without a full cycle, 30 minutes downtime for repairs.
States:
1. Motor/Drive (Y1) is off, Sensor is at HOME (X2), LED status: ON
2. Motor/Drive (Y1) is ON, Sensor is at HOME (X2), IgnoreHomeSensor (C1) ON LED status: Flashing
3. Motor/Drive