diff --git a/website/index/samples/sample.st.txt b/website/index/samples/sample.st.txt index 06ffe9fb..7fcfd8a3 100644 --- a/website/index/samples/sample.st.txt +++ b/website/index/samples/sample.st.txt @@ -1,14 +1,34 @@ -FUNCTION_BLOCK SubFB -VAR_INPUT -TimeIN : BOOL; (* Boolean input variable *) -TimeQ : BOOL; (* Boolean input variable *) -END_VAR -VAR_IN_OUT -Timer : TON; (* pointer to instance Time1 of TON – input/output variable *) -END_VAR -VAR_OUTPUT -Time3 : TON; (* 3rd instance of TON *) -END_VAR -VAR -Start : BOOL := TRUE; (* local Boolean variable *) -END_VAR \ No newline at end of file +CONFIGURATION DefaultCfg + VAR_GLOBAL + Start_Stop AT %IX0.0: BOOL; (* This is a comment *) + END_VAR + TASK NewTask (INTERVAL := T#20ms); + PROGRAM Main WITH NewTask : PLC_PRG; +END_CONFIGURATION + +PROGRAM demo + VAR_EXTERNAL + Start_Stop: BOOL; + END_VAR + VAR + a : REAL; // Another comment + todTest: TIME_OF_DAY := TOD#12:55; + END_VAR + a := csq(12.5); + TON1(IN := TRUE, PT := T#2s); + 16#FAC0 2#1001_0110 + IF TON1.Q AND a > REAL#100 THEN + Start_Stop := TRUE; + END_IF +END_PROGRAM; + +/* Get a square of the circle */ +FUNCTION csq : REAL + VAR_INPUT + r: REAL; + END_VAR + VAR CONSTANT + c_pi: REAL := 3.14; + END_VAR + csq := ABS(c_pi * (r * 2)); +END_FUNCTION \ No newline at end of file