Let’s continue working on the programming for the feeder in LAD and SCL languages.
Variable List:
Variable Name | Type | Address |
---|---|---|
xStartButton | Bool | %I0.0 |
xStopButton | Bool | %I0.1 |
xFeederActivate | Bool | %Q0.0 |
xSensor | Bool | %I0.2 |
Scenario No. 7: Moving Past the Sensor, Measured from the Front of the Container 😀
To ensure the container moves a specified distance beyond the sensor beam, we will use a TON (Timer On-Delay) timer. A set time of 750 ms allows the container to shift past the sensor by the designated distance.
How to write this in SCL? 🤔
In SCL, you need to call the timer instruction as shown in line 1. In the IF statement, refer to the Q output of the timer.
Scenario No. 8: Moving Past the Sensor, Measured from the Back of the Container 😀
"IEC_Timer_SensorStop_DB".TON(IN := NOT "xSensor",
PT := T#750ms);
IF NOT "xPrzyciskStop"
OR "IEC_Timer_SensorStop_DB".Q
THEN
"xPodajnikUruchom" := 0;
ELSIF "xPrzyciskStart" THEN
"xPodajnikUruchom" := 1;
END_IF;
Scenario No. 8: Moving Past the Sensor, Measured from the Back of the Container 😀
Let’s assume we want the distance traveled by the container to be measured from its back end. In this case, we need to capture the moment when the back of the container stops intersecting the sensor beam and then extend the movement time for this object. Here, we’ll use a TOF (Timer OFF-delay), which effectively “extends” the high state of the sensor signal. Then, we’ll detect the falling edge of the timer’s output signal using the F_TRIG (Falling Edge Trigger).
How to write this in SCL? 🤔
How to write this in SCL? 🤔
What’s next? – 😀
In SCL, you need to call the timer and trigger instructions before the IF statement.
"IEC_Timer_SensorStop_DB".TOF(IN:=NOT "xSensor",
PT:=T#750ms);
"F_TRIG_DB"(CLK:="IEC_Timer_SensorStop_DB".Q);
IF NOT "xPrzyciskStop"
OR "F_TRIG_DB".Q
THEN
"xPodajnikUruchom" := 0;
ELSIF "xPrzyciskStart" THEN
"xPodajnikUruchom" := 1;
END_IF;
What’s next? 😀
- 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
That’s it for now… I invite you to check out the full Siemens PLC programming course in SCL at the link below: