Example Main Program
(* setup initial retain values - first time.
They will be read back from config file after a first time.*)
IF (Cold = FALSE) THEN
Enable := FALSE;
HiHiLimit := 100.0;
HiLimit := 90.0;
ReturnStatus := Event_Clear();
ReturnStatus := Event_Log(State_Cold, 0, 0.0);
Cold := TRUE;
END_IF;
(* setup non-retain variables after a warm start *)
IF (Warm = False) THEN
(* for each input clear the state and set the output to ON *)
FOR pos := 1 TO ANY_TO_DINT(Input_Size) DO
State[pos] := State_OK;
Output[pos] := 1;
END_FOR;
ReturnStatus := Event_Log(State_Warm, 0, 0.0);
Warm := TRUE;
END_IF;
Variables
| Name | Type | Dir | Attr | Retained |
| Cold | Bool | Var | R/W | Yes |
| Warm | Bool | Var | R/W | No |
Defined words (#define in C++)
| Defined Words | Value |
| State_Unused | 0 |
| State_OK | 1 |
| State_HiHi | 2 |
| State_Cold | 3 |
| State_Warm | 4 |
No comments:
Post a Comment