Project: Sorter in Text
Part of the Structured Text section of Coddy's PLC Programming journey. Lesson 16 of 17.
The sorting conveyor, in text. Tall boxes go into the side bin; short ones ride on to the end.
The Tall sensor sits before the pusher. A tall box reaches the pusher 2400 ms after it reaches the sensor, so the program has to remember the box and wait:
- an R_TRIG on Tall sets a BOOL
Waiting - a TON of 2400 ms runs while Waiting is TRUE; when it is done, Waiting goes back to FALSE
- a TP gives the pusher one 300 ms stroke when the TON is done
Boxes arrive 3 s apart, so only one box is ever waiting. Time is written T#2400ms.
Challenge
Hard- Run the
Beltfrom Start, with a seal-in, until Stop. - Push every tall box into the side bin: wait 2400 ms after
Tall, then 300 ms ofPusher. - Short boxes must ride to the end.
Press Run, try it on the machine, then Check.
Try it yourself
VAR
TallSeen : R_TRIG;
Waiting : BOOL;
Delay : TON;
Push : TP;
END_VAR
// The belt: Start, Stop and a seal-in
// Tall seen: start waiting
// After 2400 ms: a 300 ms push
All lessons in Structured Text
Practice on your own: PLC playground