Motor Jog Control
Siemens S7-1200 PLC application with SCL, LAD,
FBD, and schematic diagram
|
Category |
Motor
and Drive Control |
|
TIA Portal Block |
FB_002_MotorJogControl |
|
Template Type |
motor |
|
Application |
Motor
Jog Control |
|
Source Files |
SCL/002_MotorJogControl.scl
| LAD/002_MotorJogControl_LAD.md | FBD/002_MotorJogControl_FBD.md |
Schematic Diagram
Functional schematic overview for the PLC
application.
I/O and Internal Tags
|
Area |
Tag |
Type |
Default |
Description |
|
INPUT |
StartPB |
Bool |
|
|
|
INPUT |
StopPB |
Bool |
|
|
|
INPUT |
ResetPB |
Bool |
|
|
|
INPUT |
AutoMode |
Bool |
TRUE |
|
|
INPUT |
EStopOK |
Bool |
|
|
|
INPUT |
Permissive1 |
Bool |
|
|
|
INPUT |
Permissive2 |
Bool |
|
|
|
INPUT |
FeedbackOK |
Bool |
|
|
|
INPUT |
FeedbackDelay |
Time |
T#3s |
|
|
OUTPUT |
RunCommand |
Bool |
|
|
|
OUTPUT |
RunLamp |
Bool |
|
|
|
OUTPUT |
ReadyLamp |
Bool |
|
|
|
OUTPUT |
FaultLamp |
Bool |
|
|
|
OUTPUT |
FaultCode |
Int; |
|
0 none, 1
estop, 2 permissive1, 3 permissive2, 4 feedback |
|
VAR |
StartPB |
Bool |
|
|
|
VAR |
StopPB |
Bool |
|
|
|
VAR |
ResetPB |
Bool |
|
|
|
VAR |
AutoMode |
Bool |
TRUE |
|
|
VAR |
EStopOK |
Bool |
|
|
|
VAR |
Permissive1 |
Bool |
|
|
|
VAR |
Permissive2 |
Bool |
|
|
|
VAR |
FeedbackOK |
Bool |
|
|
|
VAR |
FeedbackDelay |
Time |
T#3s |
|
SCL Program
// Application 002: Motor Jog Control
// Category: Motor and Drive Control
// PLC: Siemens S7-1200
// Language: SCL for TIA Portal
// Note: Training template. Validate all safety and
machine behavior before commissioning.
FUNCTION_BLOCK "FB_002_MotorJogControl"
{ S7_Optimized_Access := 'TRUE' }
VERSION : 1.0
VAR_INPUT
StartPB : Bool;
StopPB : Bool;
ResetPB : Bool;
AutoMode : Bool
:= TRUE;
EStopOK : Bool;
Permissive1 :
Bool;
Permissive2 :
Bool;
FeedbackOK :
Bool;
FeedbackDelay :
Time := T#3s;
END_VAR
VAR_OUTPUT
RunCommand :
Bool;
RunLamp : Bool;
ReadyLamp :
Bool;
FaultLamp :
Bool;
FaultCode :
Int; // 0 none, 1 estop, 2 permissive1, 3 permissive2, 4 feedback
END_VAR
VAR
RunLatch :
Bool;
FeedbackTimer :
TON;
FeedbackFault :
Bool;
END_VAR
BEGIN
IF ResetPB AND
EStopOK AND Permissive1 AND Permissive2 THEN
FeedbackFault := FALSE;
FaultCode
:= 0;
END_IF;
IF NOT EStopOK
THEN
FaultCode
:= 1;
ELSIF NOT
Permissive1 THEN
FaultCode
:= 2;
ELSIF NOT
Permissive2 THEN
FaultCode
:= 3;
ELSIF
FeedbackFault THEN
FaultCode
:= 4;
END_IF;
IF StopPB OR
(FaultCode <> 0) OR NOT AutoMode THEN
RunLatch :=
FALSE;
ELSIF StartPB
AND AutoMode AND EStopOK AND Permissive1 AND Permissive2 AND (FaultCode = 0)
THEN
RunLatch :=
TRUE;
END_IF;
RunCommand :=
RunLatch AND AutoMode AND EStopOK AND Permissive1 AND Permissive2 AND
(FaultCode = 0);
FeedbackTimer(IN := RunCommand AND NOT FeedbackOK, PT := FeedbackDelay);
IF
FeedbackTimer.Q THEN
FeedbackFault := TRUE;
RunLatch :=
FALSE;
FaultCode
:= 4;
END_IF;
RunLamp :=
RunCommand AND FeedbackOK;
ReadyLamp :=
AutoMode AND EStopOK AND Permissive1 AND Permissive2 AND (FaultCode = 0) AND
NOT RunCommand;
FaultLamp :=
FaultCode <> 0;
END_FUNCTION_BLOCK
Ladder Logic (LAD) Networks
Network 1 - Reset and fault selection
ResetPB AND EStopOK AND Permissive1 AND Permissive2 ----
FeedbackFault (R)
ResetPB AND EStopOK AND Permissive1 AND Permissive2 ----
MOVE 0 -> FaultCode
NOT EStopOK --------------------------------------------
MOVE 1 -> FaultCode
NOT Permissive1 ----------------------------------------
MOVE 2 -> FaultCode
NOT Permissive2 ----------------------------------------
MOVE 3 -> FaultCode
FeedbackFault ------------------------------------------
MOVE 4 -> FaultCode
Network 2 - Run latch
StartPB AND AutoMode AND EStopOK AND Permissive1 AND
Permissive2 AND [FaultCode = 0] ---- RunLatch (S)
StopPB OR [FaultCode <> 0] OR NOT AutoMode
------------------------------------------------ RunLatch (R)
Network 3 - Run command
RunLatch AND AutoMode AND EStopOK AND Permissive1 AND
Permissive2 AND [FaultCode = 0] ----( ) RunCommand
Network 4 - Feedback supervision
RunCommand AND NOT FeedbackOK -> TON FeedbackTimer, PT
= FeedbackDelay
FeedbackTimer.Q ------------- FeedbackFault (S)
FeedbackTimer.Q ------------- RunLatch (R)
FeedbackTimer.Q ------------- MOVE 4 -> FaultCode
Network 5 - Indication
RunCommand AND FeedbackOK
----------------------------------------------------( ) RunLamp
AutoMode AND EStopOK AND Permissive1 AND Permissive2 AND
[FaultCode = 0] AND NOT RunCommand --( ) ReadyLamp
[FaultCode <>
0]-------------------------------------------------------------( ) FaultLamp
Commissioning reminder: validate all I/O mapping,
permissive behavior, feedback wiring, emergency-stop circuits, and local safety
requirements before running real equipment.
Function Block Diagram (FBD) Networks
Network 1 - Reset/fault logic
AND(ResetPB, EStopOK, Permissive1, Permissive2) ->
RESET FeedbackFault, MOVE 0 -> FaultCode
NOT(EStopOK) -> MOVE 1 -> FaultCode
NOT(Permissive1) -> MOVE 2 -> FaultCode
NOT(Permissive2) -> MOVE 3 -> FaultCode
FeedbackFault -> MOVE 4 -> FaultCode
Network 2 - Run latch
SR RunLatch
S := AND(StartPB, AutoMode, EStopOK, Permissive1,
Permissive2, EQ(FaultCode, 0))
R := OR(StopPB, NE(FaultCode, 0), NOT(AutoMode))
Network 3 - Output and feedback
AND(RunLatch, AutoMode, EStopOK, Permissive1,
Permissive2, EQ(FaultCode, 0)) -> RunCommand
TON FeedbackTimer(IN := AND(RunCommand, NOT(FeedbackOK)),
PT := FeedbackDelay)
FeedbackTimer.Q -> SET FeedbackFault, RESET RunLatch,
MOVE 4 -> FaultCode
Network 4 - Indication
AND(RunCommand, FeedbackOK) -> RunLamp
AND(AutoMode, EStopOK, Permissive1, Permissive2,
EQ(FaultCode, 0), NOT(RunCommand)) -> ReadyLamp
NE(FaultCode, 0) -> FaultLamp
Commissioning reminder: validate all I/O mapping,
permissive behavior, feedback wiring, emergency-stop circuits, and local safety
requirements before running real equipment.
Commissioning Checklist
·
Map every PLC tag to the correct
physical input, output, HMI tag, or memory address.
·
Compile in TIA Portal and adjust
tag names, timers, and setpoints for the real machine.
·
Test normal sequence, stop, reset,
feedback failure, timeout, and alarm conditions in simulation first.
·
Use certified safety hardware or
fail-safe logic for emergency stops, guards, and hazardous motion.
No comments:
Post a Comment