AnnexF/delay_st.txt
author Andrey Skvortsov <andrej.skvortzov@gmail.com>
Fri, 06 May 2016 11:48:02 +0300
changeset 1008 59435d4c5e0c
parent 0 fb772792efd1
permissions -rwxr-xr-x
fix compilation error about missing braces

IEC_TIMESPEC has two fields tv_sec and tv_nsec.

Compilation error:
./build/POUS.c:600:45: error: missing braces around initializer [-Werror=missing-braces]
static const STEP temp_step = {{0, 0}, 0, {0, 0}};
^
compilation terminated due to -Wfatal-errors.
FUNCTION_BLOCK DELAY    (* N-sample delay *)
  VAR_INPUT
    RUN : BOOL ;     (* 1 = run, 0 = reset *)
    XIN : REAL ;
    N   : INT        (* 0 <= N < 128 or manufacturer- *)
  END_VAR            (*      specified maximum value  *)
  VAR_OUTPUT XOUT : REAL; END_VAR   (* Delayed output *)
  VAR X : ARRAY [0..127]     (* N-Element queue *)
               OF REAL;      (* with FIFO discipline *)
      I, IXIN, IXOUT : INT := 0;
  END_VAR
  IF RUN THEN IXIN := MOD(IXIN + 1, 128) ; X[IXIN] := XIN ;
              IXOUT := MOD(IXOUT + 1, 128) ; XOUT := X[IXOUT];
  ELSE XOUT := XIN ; IXIN := N ; IXOUT := 0;
       FOR I := 0 TO N DO X[I] := XIN; END_FOR;
  END_IF ;
END_FUNCTION_BLOCK