Application Overview
This article covers PLC programming logic for upgrading an SLC 150 to MicroLogix 1400 on a school milk carton caser machine. The application requires coordinating two pneumatic pushers fed by two product lines, controlled by a 2-position Directional Control Valve (DCV), with a total of 5 pushes per tier cycle.
I/O Assignment Strategy
Effective sequencing requires clear input/output mapping. The following table provides a recommended I/O structure:
| Type | Address | Description |
|---|---|---|
| Input | I:0.0/0 | Photo Eye (product backup detection) |
| Input | I:0.0/1 | Forward Position Switch (pusher fully extended) |
| Input | I:0.0/2 | Mid-Position Switch (half-stroke) |
| Input | I:0.0/3 | Retracted Position Switch |
| Input | I:0.0/4 | Head Up Switch (pickup head raised) |
| Input | I:0.0/5 | Head Down Switch (pickup head at product) |
| Input | I:0.0/6 | Line 1 Run Status |
| Input | I:0.0/7 | Line 2 Run Status |
| Output | O:0.0/0 | DCV Extend Solenoid (Pusher 1) |
| Output | O:0.0/1 | DCV Retract Solenoid (Pusher 1) |
| Output | O:0.0/2 | DCV Extend Solenoid (Pusher 2) |
| Output | O:0.0/3 | DCV Retract Solenoid (Pusher 2) |
State Machine Design
The application requires a state machine architecture to manage the complex sequencing. Each pusher operates in distinct phases:
- WAIT - Pusher at forward position, awaiting product backup
- DETECT - Product backed up to photo eye for 2+ seconds
- RETRACT - DCV retracts to allow product entry
- ADVANCE_HALF - Pusher advances to mid-position switch
- PUSH - Push product toward case
- RETRACT_PUSH - Retract for next product
- WAIT_HEAD - Extend past mid-switch, wait for head to lower
- HEAD_GRAB - Head descends and grabs product
- SYNC_RETACT - Both pushers retract while head lowers
- FINAL_PUSH - Complete remaining pushes
Ladder Logic Structure
The following structured text pattern (compatible with RSLogix 500) implements the core sequencing:
// Main Sequence Controller
// Cycle Counter: N7:0 (total pushes)
// Push1 Counter: N7:1, Push2 Counter: N7:2
// State Register: N7:10
// 0=WAIT, 1=DETECT, 2=RETRACT, 3=ADVANCE_HALF
// 4=PUSH, 5=RETRACT_PUSH, 6=WAIT_HEAD, 7=HEAD_GRAB
// 8=SYNC_RETRACT, 9=FINAL_PUSH, 10=CYCLE_DONE
// Line Selection Logic
IF I:0.0/6 AND I:0.0/7 THEN // Both lines running
Push1_Target := 3;
Push2_Target := 2;
ELSIF I:0.0/6 OR I:0.0/7 THEN // Single line
Push1_Target := 5;
Push2_Target := 0;
END_IF;
// 2-Second Photo Eye Timer
TON(Timer=PTW, Preset=20, Input=I:0.0/0);
// State Transition Logic (Pusher 1 Example)
CASE N7:10 OF
0: // WAIT
IF PTW.DN AND I:0.0/1 THEN // Product detected, pusher forward
N7:10 := 1;
END_IF;
1: // DETECT
O:0.0/1 := 1; // Retract solenoid
IF I:0.0/3 THEN // Fully retracted
N7:10 := 2;
END_IF;
2: // ADVANCE_HALF
O:0.0/0 := 1; // Extend solenoid
IF I:0.0/2 THEN // Mid-switch made
N7:10 := 3;
N7:1 := N7:1 + 1; // Increment push counter
END_IF;
3: // RETRACT_PUSH
O:0.0/1 := 1;
IF I:0.0/3 THEN
IF N7:1 < Push1_Target THEN
N7:10 := 1; // Return to DETECT
ELSIF N7:1 >= Push1_Target AND N7:0 < 5 THEN
N7:10 := 4; // Wait for head
ELSE
N7:10 := 10; // Cycle complete
END_IF;
END_IF;
4: // WAIT_HEAD
O:0.0/0 := 1; // Extend past mid-switch
IF I:0.0/1 THEN // Forward switch made
N7:10 := 5; // Wait for head down
END_IF;
5: // HEAD_GRAB
IF I:0.0/5 THEN // Head down switch
N7:10 := 6;
END_IF;
6: // SYNC_RETRACT
O:0.0/1 := 1; // Retract while head passes
IF NOT I:0.0/4 THEN // Head not up yet
N7:10 := 7; // Continue to mid-push
END_IF;
7: // FINAL_PUSH
O:0.0/0 := 1;
IF I:0.0/2 THEN
N7:1 := N7:1 + 1;
N7:10 := 6;
END_IF;
IF N7:1 >= Push1_Target THEN
N7:10 := 10;
END_IF;
10: // CYCLE_DONE
// Reset for next cycle
N7:10 := 0;
N7:1 := 0;
N7:2 := 0;
END_CASE;
Key Programming Considerations
Debouncing Photo Eye Input
The 2-second timer (TON instruction with preset of 20 for 100ms base) provides debouncing for the photo eye. Adjust the preset based on actual product spacing and conveyor speed. Product must consistently block the PE for the full 2 seconds before triggering retraction.
DCV Solenoid Overlap Prevention
Ensure extend and retract outputs never energize simultaneously. Implement interlocking in the ladder logic:
// Interlock Rung
XIC(O:0.0/0) OTL(O:0.0/1);
XIC(O:0.0/2) OTL(O:0.0/3);
Head Synchronization Timing
The "head up" switch (I:0.0/4) must be monitored during the SYNC_RETRACT state. The pushers must complete their single mid-position push and retract before the head fully raises. Add a failsafe timeout:
// Head timeout - abort if head takes too long
TON(HeadTimer, Preset=50, Input=(N7:10=6));
IF HeadTimer.DN AND N7:10=6 THEN
// Fault - halt production
O:0.0/0 := 0;
O:0.0/1 := 0;
O:0.0/2 := 0;
O:0.0/3 := 0;
END_IF;
Single Line Operation Mode
When only one line runs, the active pusher must complete all 5 pushes before cycling. This requires dynamic target adjustment:
// Single line push distribution
IF (I:0.0/6 XOR I:0.0/7) AND N7:10 <= 3 THEN
Push1_Target := 5; // All pushes on active line
Push2_Target := 0;
END_IF;
// Two-stage push for single line
IF N7:1 = 3 AND N7:10 = 3 THEN
// First 3 pushes complete - wait for product backup again
N7:10 := 0; // Return to wait state
END_IF;
Debugging Tips
- Use Project Properties → Controller Tags to monitor N7:10 (state) and counter values in real-time
- Force outputs sparingly during testing - use momentary override with immediate reset
- Single-step through CASE statement using Debug → Toggle Breakpoint
- Verify all switches are properly wired with LED indicators at the cabinet
Before You Start
FAQ
How do I configure the TON timer for the 2-second photo eye delay?
Use a TON instruction with Time Base set to 1.0 and Preset value of 20 (20 × 100ms = 2000ms). The Timer Done bit (TTW.DN) triggers the state transition.
Can I use a single DCV to control both pushers?
No - each pusher requires independent DCV control because they operate at different phases (one may be advancing while the other retracts). Use separate solenoid outputs for each pusher.
What MicroLogix 1400 model do I need for this application?
The 1766-L32BXBA or 1766-L32BXB (32-point, 24VDC I/O) provides sufficient discrete points. Verify total I/O count matches your sensor/actuator requirements.
How do I handle the "whichever pusher opens first" logic?
Use a first-pass flag (S:1/15) to capture which line's photo eye activates first during dual-line mode. Store this in a boolean (B3:0/0) and use it to assign push counts: the first-detected line gets 3 pushes, the other gets 2.
What's the safest way to test the sequence without product?
Use the Force function in RSLogix 500 to simulate input transitions. Start by forcing the photo eye ON, then force position switches to verify state transitions. Always have the machine in MANUAL mode with E-Stop accessible.