// Top enbreakers
upperLimit:= EB_TL OR EB_TR;
IF upperLimit AND NOT topPosSet THEN
pos:=actPos;
Execute:=FALSE;
topPosSet :=TRUE;
END_IF
IF topPosSet AND (setPos < actPos) THEN
pos:= setPos;
Execute:=TRUE;
IF NOT upperLimit THEN
topPosSet := FALSE;
END_IF
END_IF
// Bottom endbreakers
bottomLimit:= EB_BL OR EB_BR;
IF bottomLimit AND NOT bottomPosSet THEN
pos:=actPos;
Execute:=FALSE;
bottomPosSet :=TRUE;
END_IF
IF bottomPosSet AND (setPos > actPos) THEN
pos:= setPos;
Execute:=TRUE;
IF NOT bottomLimit THEN
bottomPosSet := FALSE;
END_IF
END_IF
// Set pos equal to setpoint if not bottom or top limit
IF NOT upperLimit AND NOT bottomLimit THEN
pos:= setPos;
END_IF |