Let’s continue working on PLC Programming the start-up circuit for the conveyor in LAD and SCL.
Variable List:
Variable Name | Type | Address |
---|---|---|
xStartButton | Bool | %I0.0 |
xStopButton | Bool | %I0.1 |
xConveyorStart | Bool | %Q0.0 |
xSensor | Bool | %I0.2 |
Scenario #4: Start-Up Circuit with Start and Stop Buttons 😀 – with Flip-Flop
Pressing the Start button activates the conveyor. After releasing the button, the conveyor stops.
How to write this in SCL? 🤔
In SCL, you need to use the conditional instruction IF… ELSEIF…
IF NOT xPrzyciskStop THEN
xPodajnikUruchom := TRUE;
ELSIF xPrzyciskStart THEN
xPodajnikUruchom := TRUE;
ELSE
xPodajnikUruchom := FALSE;
END_IF;
Scenario #5: Move to Sensor 😀
Pressing the Start button activates the conveyor. When the button is released, the conveyor stops. Additionally, breaking the sensor beam stops the conveyor. Note that the sensor signal is of the NC (Normally Closed) type – meaning that when the beam is not broken, the controller sees a TRUE (high) value at the input.
How to write this in SCL? 🤔
In SCL, you need to add an additional logical condition related to the sensor variable, “xSensor”, to the IF… ELSEIF… conditional statement.
Translation:
IF NOT "xPrzyciskStop"
OR NOT "xSensor"
THEN
"xPodajnikUruchom" := 0;
ELSIF "xPrzyciskStart" THEN
"xPodajnikUruchom" := 1;
END_IF;
Scenario #6: Move Past the Sensor 😀
To position the container beyond the sensor, it will be necessary to detect the rising edge of the sensor signal (remember, this is an NC signal). For this purpose, we will use a trigger instruction in LAD language.
How to write this in SCL? 🤔
In SCL, you need to call the trigger function block separately in line 1. In line 4, we reference the Q output from this function block.
"R_TRIG_DB"(CLK:="xSensor");
IF NOT "xPrzyciskStop"
OR "R_TRIG_DB".Q
THEN
"xPodajnikUruchom" := 0;
ELSIF "xPrzyciskStart" THEN
"xPodajnikUruchom" := 1;
END_IF;
What’s next? 😀
Head over to part 3, where we’ll dive deeper into expanding our program’s functionality. I’ll introduce you to advanced SCL language instructions, showing you how to enhance control logic and optimize performance for more complex automation tasks!
- Boolean Operations – PLC Programming in SCL Language #1
- IF… THEN Instruction – PLC Programming in SCL #2
- Trigger, Timer in SCL – PLC Programming in SCL Language #3