Structure Text Programming - Codesys 14
Structure Text Programming - Codesys 14
SBR();
IF S:FS THEN
state := 0;
green_EW.TimerEnable := 1;
yellow_EW.TimerEnable := 0;
green_NS.TimerEnable := 0;
yellow_NS.TimerEnable := 0; Note: This example is for the AB
END_IF; ControlLogix platform, so it
does not show the normal
TONR(green_EW); TONR(yellow_EW); function and tag definitions.
TONR(green_NS); TONR(yellow_NS); These are done separately in
the tag editor.
CASE state OF
0: IF green_EW.DN THEN state : DINT
state :=1; green_EW : FBD_TIMER
green_EW.TimerEnable := 0; yellow_EW : FBD_TIMER
yellow_EW.TimerEnable := 1; green_NS : FBD_TIMER
END_IF yellow_NS : FBD_TIMER
1: IF yellow_EW.DN THEN light_EW_green : BOOL alias =
state :=2; rack:1:O.Data.0
yellow_EW.TimerEnable := 0; light_EW_yellow : BOOL alias =
green_NS.TimerEnable := 1; rack:1:O.Data.1
END_IF light_EW_red : BOOL alias =
2: IF green_NS.DN THEN rack:1:O.Data.2
state :=3; light_NS_green : BOOL alias =
green_NS.TimerEnable := 0; rack:1:O.Data.3
yellow_NS.TimerEnable := 1; light_NS_yellow : BOOL alias =
END_IF rack:1:O.Data.4
3: IF yellow_NS.DN THEN light_NS_red : BOOL alias =
state :=0; rack:1:O.Data.5
yellow_NS.TimerEnable := 0;
green_EW.TimerEnable := 1;
END_IF
RET();