(* Motor start/stop station: reference solution in IEC 61131-3 Structured Text. *) VAR_GLOBAL Start_PB AT %IX0.0 : BOOL; (* Start pushbutton, normally open *) Stop_PB AT %IX0.1 : BOOL; (* Stop pushbutton, normally closed, 1 when healthy *) EStop_OK AT %IX0.2 : BOOL; (* Emergency stop, normally closed, 1 when healthy *) Motor AT %QX0.0 : BOOL; (* Motor contactor *) Run_Lamp AT %QX0.1 : BOOL; (* Running indicator *) END_VAR PROGRAM Main (* Start with a seal-in. Stop_PB and EStop_OK are normally closed, *) (* TRUE while healthy, so a broken wire stops the motor too. *) Motor := (Start_PB OR Motor) AND Stop_PB AND EStop_OK; Run_Lamp := Motor; END_PROGRAM