Concept Flow - Flashing light circuit with timers
Start
Timer ON Delay
Light ON
Timer OFF Delay
Light OFF
Repeat Cycle
The flashing light circuit uses two timers to alternate the light ON and OFF states repeatedly.
(* Proper PLC code for flasher *) (* Assume always true input *) Timer1(IN := NOT Timer2.Q, PT := T#1s); Light := Timer1.Q; Timer2(IN := Timer1.Q, PT := T#1s);
| Step | Timer1.Elapsed | Timer1.Q | Timer2.Elapsed | Timer2.Q | Light | Action |
|---|---|---|---|---|---|---|
| 1 | 0s | False | 0s | False | False | Start timers, light OFF |
| 2 | 0.5s | False | 0s | False | False | Timer1 counting (IN true since NOT Timer2.Q), light OFF |
| 3 | 1s | True | 0s | False | True | Timer1 done, light ON, Timer2 starts (IN=Timer1.Q) |
| 4 | 1s | True | 0.5s | False | True | Timer2 counting, light ON (Timer1.Q) |
| 5 | 1s | True | 1s | True | False | Timer2 done; Timer1 IN=false (NOT Timer2.Q=false), resets elapsed, Q stays until next scan but light off next cycle |
| 6 | 0s | False | 1s | True | False | Timer1 reset (IN now false since NOT Timer2.Q=false) |
| 7 | 0.5s | False | 1s | True | False | Timer1 counting again |
| 8 | 1s | True | 1s | True | True | Timer1 done, light ON, Timer2 IN=true but since Q true, but to reset Timer2 need explicit reset or IN false |
| 9 | 1s | True | 0s | False | True | Timer2 reset (typically R_TRIG on Timer1.Q resets Timer2) |
| 10 | 1s | True | 0.5s | False | True | Timer2 counting |
| 11 | 1s | True | 1s | True | False | Timer2 done, light OFF, reset Timer1 |
| 12 | End | End | End | End | End | Cycle repeats indefinitely |
| Variable | Start | After Step 3 | After Step 5 | After Step 8 | After Step 11 | Final |
|---|---|---|---|---|---|---|
| Timer1.Elapsed | 0s | 1s | 0s | 1s | 1s | Repeats 0 to 1s |
| Timer1.Q | False | True | False | True | True | Alternates True/False |
| Timer2.Elapsed | 0s | 0s | 1s | 0s | 1s | Repeats 0 to 1s |
| Timer2.Q | False | False | True | False | True | Alternates True/False |
| Light | False | True | False | True | False | Flashes ON/OFF |
Flashing light: Two TON timers mutually control IN: Timer1.IN=NOT Timer2.Q (ON phase), Light=Timer1.Q, Timer2.IN=Timer1.Q (OFF phase). Cycle: ON 1s, OFF 1s, repeat.
TON T1(IN:=Start, PT:=T#2s); IF T1.Q THEN Light := NOT Light; T1(IN:=FALSE); END_IF;
TON T1(IN:=Start, PT:=T#3s); IF T1.Q THEN Light := NOT Light; END_IF; T1(IN:=Start);
Pass the test and this pattern moves unknown