Technical data
Creating STL Source Files
13.7 Examples of STL Source Files
Programming with STEP 7
Manual, 05/2010, A5E02789666-01 305
FUNCTION_BLOCK FB6
TITLE = Simple traffic light switching
// Traffic light control of pedestrian crosswalk
// on main street
{S7_m_c := 'true'} //System attribute for blocks
AUTHOR : Siemens
FAMILY : Traffic light
NAME : Traffic light01
VERSION : 1.3
VAR_INPUT
starter : BOOL := FALSE; // Cross request from pedestrian
t_dur_y_car : TIMER; // Duration green for pedestrian
t_next_r_car : TIMER; // Duration between red phases for cars
t_dur_r_car : TIMER;
number {S7_server := 'alarm_archiv'; S7_a_type := 'alarm_8'} :DWORD;
// Number of cars
// number has system attributes for parameters
END_VAR
VAR_OUTPUT
g_car : BOOL := FALSE; // GREEN for cars_
END_VAR
VAR
condition : BOOL := FALSE; // Condition red for cars
END_VAR
BEGIN
NETWORK
TITLE = Condition red for main street traffic
// After a minimum duration has passed, the request for green at the
// pedestrian crosswalk forms the condition red
// for main street traffic.
A(;
A #starter; // Request for green at pedestrian crosswalk and
A #t_next_r_car; // time between red phases up
O #condition; // Or condition for red
);
AN #t_dur_y_car; // And currently no red light
= #condition; // Condition red
= #g_car; // GREEN for main street traffic
// traffic lights