lib/C/iec_std_FB.h
author Mario de Sousa <msousa@fe.up.pt>
Wed, 30 Aug 2017 21:57:18 +0100
changeset 1059 aef63aa7ef2e
parent 1011 76175defb87b
child 1094 068c28266332
permissions -rw-r--r--
add support for generating functions to backup/restore the internal state of the PLC.
905
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
     1
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
     2
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
     3
/****
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
     4
 * IEC 61131-3 standard function block library
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
     5
 */
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
     6
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
     7
/* NOTE: The code in this file was generated by iec2c (i.e. matiec C compiler), using as source
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
     8
 *        the *.txt files in the 'lib' directory.
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
     9
 *       The only 'manual' change was:
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    10
 *          - to merge the generated .h and .c files into this single file
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    11
 *          - to remove the forward declarations of the functions
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    12
 *          - to change the function prototypes to become 'static'.
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    13
 *             e.g.:   static void R_TRIG_init__(...)
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    14
 *                     ^^^^^^
905
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    15
 * 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    16
 * NOTE: If the structure of the C code generated by iec2c (matiec) should change, then this C 'library'
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    17
 *       file will need to be recompiled. 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    18
 *       The correct way of going about this would be to have this file be automatically generated during
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    19
 *       the build process (i.e. after compiling matiec), but we will leave this for later if it ever
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    20
 *       becomes necessary.
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    21
 * 
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    22
 * WARNING: There are 2 versions of this file:
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    23
 *            - file: iec_std_FB.h
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    24
 *              Version to be used when the EN and ENO parameters are implicitly generated
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    25
 *              for all functions and function blocks
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    26
 *            - file: iec_std_FB_no_ENENO.h
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    27
 *              Version to be used when the EN and ENO parameters are NOT implicitly generated
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    28
 *              for all functions and function blocks
905
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    29
 */
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    30
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    31
#ifndef _IEC_STD_FB_H
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    32
#define _IEC_STD_FB_H
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    33
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    34
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    35
#include "accessor.h"
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    36
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    37
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    38
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    39
// FUNCTION_BLOCK R_TRIG
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    40
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    41
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    42
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    43
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    44
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    45
  __DECLARE_VAR(BOOL,CLK)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    46
  __DECLARE_VAR(BOOL,Q)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    47
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    48
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    49
  __DECLARE_VAR(BOOL,M)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    50
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    51
} R_TRIG;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    52
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    53
// FUNCTION_BLOCK F_TRIG
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    54
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    55
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    56
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    57
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    58
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    59
  __DECLARE_VAR(BOOL,CLK)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    60
  __DECLARE_VAR(BOOL,Q)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    61
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    62
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    63
  __DECLARE_VAR(BOOL,M)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    64
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    65
} F_TRIG;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    66
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    67
// FUNCTION_BLOCK SR
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    68
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    69
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    70
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    71
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    72
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    73
  __DECLARE_VAR(BOOL,S1)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    74
  __DECLARE_VAR(BOOL,R)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    75
  __DECLARE_VAR(BOOL,Q1)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    76
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    77
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    78
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    79
} SR;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    80
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    81
// FUNCTION_BLOCK RS
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    82
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    83
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    84
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    85
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    86
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    87
  __DECLARE_VAR(BOOL,S)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    88
  __DECLARE_VAR(BOOL,R1)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    89
  __DECLARE_VAR(BOOL,Q1)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    90
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    91
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    92
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    93
} RS;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    94
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    95
// FUNCTION_BLOCK CTU
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    96
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    97
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    98
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
    99
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   100
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   101
  __DECLARE_VAR(BOOL,CU)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   102
  __DECLARE_VAR(BOOL,R)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   103
  __DECLARE_VAR(INT,PV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   104
  __DECLARE_VAR(BOOL,Q)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   105
  __DECLARE_VAR(INT,CV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   106
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   107
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   108
  R_TRIG CU_T;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   109
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   110
} CTU;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   111
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   112
// FUNCTION_BLOCK CTU_DINT
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   113
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   114
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   115
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   116
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   117
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   118
  __DECLARE_VAR(BOOL,CU)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   119
  __DECLARE_VAR(BOOL,R)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   120
  __DECLARE_VAR(DINT,PV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   121
  __DECLARE_VAR(BOOL,Q)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   122
  __DECLARE_VAR(DINT,CV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   123
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   124
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   125
  R_TRIG CU_T;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   126
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   127
} CTU_DINT;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   128
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   129
// FUNCTION_BLOCK CTU_LINT
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   130
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   131
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   132
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   133
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   134
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   135
  __DECLARE_VAR(BOOL,CU)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   136
  __DECLARE_VAR(BOOL,R)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   137
  __DECLARE_VAR(LINT,PV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   138
  __DECLARE_VAR(BOOL,Q)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   139
  __DECLARE_VAR(LINT,CV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   140
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   141
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   142
  R_TRIG CU_T;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   143
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   144
} CTU_LINT;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   145
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   146
// FUNCTION_BLOCK CTU_UDINT
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   147
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   148
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   149
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   150
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   151
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   152
  __DECLARE_VAR(BOOL,CU)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   153
  __DECLARE_VAR(BOOL,R)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   154
  __DECLARE_VAR(UDINT,PV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   155
  __DECLARE_VAR(BOOL,Q)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   156
  __DECLARE_VAR(UDINT,CV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   157
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   158
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   159
  R_TRIG CU_T;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   160
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   161
} CTU_UDINT;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   162
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   163
// FUNCTION_BLOCK CTU_ULINT
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   164
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   165
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   166
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   167
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   168
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   169
  __DECLARE_VAR(BOOL,CU)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   170
  __DECLARE_VAR(BOOL,R)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   171
  __DECLARE_VAR(ULINT,PV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   172
  __DECLARE_VAR(BOOL,Q)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   173
  __DECLARE_VAR(ULINT,CV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   174
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   175
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   176
  R_TRIG CU_T;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   177
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   178
} CTU_ULINT;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   179
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   180
// FUNCTION_BLOCK CTD
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   181
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   182
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   183
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   184
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   185
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   186
  __DECLARE_VAR(BOOL,CD)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   187
  __DECLARE_VAR(BOOL,LD)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   188
  __DECLARE_VAR(INT,PV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   189
  __DECLARE_VAR(BOOL,Q)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   190
  __DECLARE_VAR(INT,CV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   191
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   192
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   193
  R_TRIG CD_T;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   194
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   195
} CTD;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   196
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   197
// FUNCTION_BLOCK CTD_DINT
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   198
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   199
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   200
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   201
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   202
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   203
  __DECLARE_VAR(BOOL,CD)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   204
  __DECLARE_VAR(BOOL,LD)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   205
  __DECLARE_VAR(DINT,PV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   206
  __DECLARE_VAR(BOOL,Q)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   207
  __DECLARE_VAR(DINT,CV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   208
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   209
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   210
  R_TRIG CD_T;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   211
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   212
} CTD_DINT;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   213
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   214
// FUNCTION_BLOCK CTD_LINT
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   215
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   216
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   217
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   218
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   219
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   220
  __DECLARE_VAR(BOOL,CD)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   221
  __DECLARE_VAR(BOOL,LD)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   222
  __DECLARE_VAR(LINT,PV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   223
  __DECLARE_VAR(BOOL,Q)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   224
  __DECLARE_VAR(LINT,CV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   225
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   226
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   227
  R_TRIG CD_T;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   228
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   229
} CTD_LINT;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   230
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   231
// FUNCTION_BLOCK CTD_UDINT
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   232
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   233
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   234
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   235
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   236
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   237
  __DECLARE_VAR(BOOL,CD)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   238
  __DECLARE_VAR(BOOL,LD)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   239
  __DECLARE_VAR(UDINT,PV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   240
  __DECLARE_VAR(BOOL,Q)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   241
  __DECLARE_VAR(UDINT,CV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   242
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   243
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   244
  R_TRIG CD_T;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   245
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   246
} CTD_UDINT;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   247
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   248
// FUNCTION_BLOCK CTD_ULINT
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   249
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   250
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   251
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   252
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   253
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   254
  __DECLARE_VAR(BOOL,CD)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   255
  __DECLARE_VAR(BOOL,LD)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   256
  __DECLARE_VAR(ULINT,PV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   257
  __DECLARE_VAR(BOOL,Q)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   258
  __DECLARE_VAR(ULINT,CV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   259
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   260
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   261
  R_TRIG CD_T;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   262
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   263
} CTD_ULINT;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   264
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   265
// FUNCTION_BLOCK CTUD
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   266
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   267
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   268
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   269
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   270
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   271
  __DECLARE_VAR(BOOL,CU)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   272
  __DECLARE_VAR(BOOL,CD)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   273
  __DECLARE_VAR(BOOL,R)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   274
  __DECLARE_VAR(BOOL,LD)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   275
  __DECLARE_VAR(INT,PV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   276
  __DECLARE_VAR(BOOL,QU)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   277
  __DECLARE_VAR(BOOL,QD)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   278
  __DECLARE_VAR(INT,CV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   279
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   280
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   281
  R_TRIG CD_T;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   282
  R_TRIG CU_T;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   283
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   284
} CTUD;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   285
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   286
// FUNCTION_BLOCK CTUD_DINT
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   287
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   288
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   289
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   290
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   291
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   292
  __DECLARE_VAR(BOOL,CU)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   293
  __DECLARE_VAR(BOOL,CD)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   294
  __DECLARE_VAR(BOOL,R)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   295
  __DECLARE_VAR(BOOL,LD)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   296
  __DECLARE_VAR(DINT,PV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   297
  __DECLARE_VAR(BOOL,QU)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   298
  __DECLARE_VAR(BOOL,QD)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   299
  __DECLARE_VAR(DINT,CV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   300
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   301
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   302
  R_TRIG CD_T;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   303
  R_TRIG CU_T;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   304
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   305
} CTUD_DINT;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   306
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   307
// FUNCTION_BLOCK CTUD_LINT
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   308
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   309
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   310
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   311
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   312
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   313
  __DECLARE_VAR(BOOL,CU)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   314
  __DECLARE_VAR(BOOL,CD)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   315
  __DECLARE_VAR(BOOL,R)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   316
  __DECLARE_VAR(BOOL,LD)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   317
  __DECLARE_VAR(LINT,PV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   318
  __DECLARE_VAR(BOOL,QU)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   319
  __DECLARE_VAR(BOOL,QD)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   320
  __DECLARE_VAR(LINT,CV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   321
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   322
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   323
  R_TRIG CD_T;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   324
  R_TRIG CU_T;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   325
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   326
} CTUD_LINT;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   327
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   328
// FUNCTION_BLOCK CTUD_UDINT
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   329
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   330
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   331
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   332
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   333
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   334
  __DECLARE_VAR(BOOL,CU)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   335
  __DECLARE_VAR(BOOL,CD)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   336
  __DECLARE_VAR(BOOL,R)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   337
  __DECLARE_VAR(BOOL,LD)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   338
  __DECLARE_VAR(UDINT,PV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   339
  __DECLARE_VAR(BOOL,QU)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   340
  __DECLARE_VAR(BOOL,QD)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   341
  __DECLARE_VAR(UDINT,CV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   342
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   343
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   344
  R_TRIG CD_T;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   345
  R_TRIG CU_T;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   346
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   347
} CTUD_UDINT;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   348
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   349
// FUNCTION_BLOCK CTUD_ULINT
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   350
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   351
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   352
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   353
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   354
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   355
  __DECLARE_VAR(BOOL,CU)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   356
  __DECLARE_VAR(BOOL,CD)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   357
  __DECLARE_VAR(BOOL,R)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   358
  __DECLARE_VAR(BOOL,LD)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   359
  __DECLARE_VAR(ULINT,PV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   360
  __DECLARE_VAR(BOOL,QU)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   361
  __DECLARE_VAR(BOOL,QD)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   362
  __DECLARE_VAR(ULINT,CV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   363
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   364
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   365
  R_TRIG CD_T;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   366
  R_TRIG CU_T;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   367
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   368
} CTUD_ULINT;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   369
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   370
// FUNCTION_BLOCK TP
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   371
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   372
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   373
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   374
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   375
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   376
  __DECLARE_VAR(BOOL,IN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   377
  __DECLARE_VAR(TIME,PT)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   378
  __DECLARE_VAR(BOOL,Q)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   379
  __DECLARE_VAR(TIME,ET)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   380
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   381
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   382
  __DECLARE_VAR(SINT,STATE)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   383
  __DECLARE_VAR(BOOL,PREV_IN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   384
  __DECLARE_VAR(TIME,CURRENT_TIME)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   385
  __DECLARE_VAR(TIME,START_TIME)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   386
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   387
} TP;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   388
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   389
// FUNCTION_BLOCK TON
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   390
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   391
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   392
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   393
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   394
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   395
  __DECLARE_VAR(BOOL,IN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   396
  __DECLARE_VAR(TIME,PT)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   397
  __DECLARE_VAR(BOOL,Q)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   398
  __DECLARE_VAR(TIME,ET)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   399
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   400
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   401
  __DECLARE_VAR(SINT,STATE)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   402
  __DECLARE_VAR(BOOL,PREV_IN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   403
  __DECLARE_VAR(TIME,CURRENT_TIME)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   404
  __DECLARE_VAR(TIME,START_TIME)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   405
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   406
} TON;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   407
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   408
// FUNCTION_BLOCK TOF
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   409
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   410
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   411
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   412
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   413
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   414
  __DECLARE_VAR(BOOL,IN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   415
  __DECLARE_VAR(TIME,PT)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   416
  __DECLARE_VAR(BOOL,Q)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   417
  __DECLARE_VAR(TIME,ET)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   418
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   419
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   420
  __DECLARE_VAR(SINT,STATE)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   421
  __DECLARE_VAR(BOOL,PREV_IN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   422
  __DECLARE_VAR(TIME,CURRENT_TIME)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   423
  __DECLARE_VAR(TIME,START_TIME)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   424
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   425
} TOF;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   426
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   427
// FUNCTION_BLOCK DERIVATIVE
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   428
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   429
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   430
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   431
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   432
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   433
  __DECLARE_VAR(BOOL,RUN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   434
  __DECLARE_VAR(REAL,XIN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   435
  __DECLARE_VAR(TIME,CYCLE)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   436
  __DECLARE_VAR(REAL,XOUT)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   437
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   438
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   439
  __DECLARE_VAR(REAL,X1)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   440
  __DECLARE_VAR(REAL,X2)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   441
  __DECLARE_VAR(REAL,X3)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   442
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   443
} DERIVATIVE;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   444
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   445
// FUNCTION_BLOCK HYSTERESIS
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   446
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   447
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   448
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   449
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   450
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   451
  __DECLARE_VAR(REAL,XIN1)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   452
  __DECLARE_VAR(REAL,XIN2)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   453
  __DECLARE_VAR(REAL,EPS)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   454
  __DECLARE_VAR(BOOL,Q)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   455
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   456
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   457
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   458
} HYSTERESIS;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   459
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   460
// FUNCTION_BLOCK INTEGRAL
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   461
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   462
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   463
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   464
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   465
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   466
  __DECLARE_VAR(BOOL,RUN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   467
  __DECLARE_VAR(BOOL,R1)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   468
  __DECLARE_VAR(REAL,XIN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   469
  __DECLARE_VAR(REAL,X0)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   470
  __DECLARE_VAR(TIME,CYCLE)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   471
  __DECLARE_VAR(BOOL,Q)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   472
  __DECLARE_VAR(REAL,XOUT)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   473
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   474
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   475
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   476
} INTEGRAL;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   477
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   478
// FUNCTION_BLOCK PID
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   479
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   480
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   481
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   482
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   483
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   484
  __DECLARE_VAR(BOOL,AUTO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   485
  __DECLARE_VAR(REAL,PV)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   486
  __DECLARE_VAR(REAL,SP)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   487
  __DECLARE_VAR(REAL,X0)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   488
  __DECLARE_VAR(REAL,KP)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   489
  __DECLARE_VAR(REAL,TR)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   490
  __DECLARE_VAR(REAL,TD)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   491
  __DECLARE_VAR(TIME,CYCLE)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   492
  __DECLARE_VAR(REAL,XOUT)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   493
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   494
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   495
  __DECLARE_VAR(REAL,ERROR)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   496
  INTEGRAL ITERM;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   497
  DERIVATIVE DTERM;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   498
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   499
} PID;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   500
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   501
// FUNCTION_BLOCK RAMP
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   502
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   503
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   504
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   505
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   506
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   507
  __DECLARE_VAR(BOOL,RUN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   508
  __DECLARE_VAR(REAL,X0)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   509
  __DECLARE_VAR(REAL,X1)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   510
  __DECLARE_VAR(TIME,TR)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   511
  __DECLARE_VAR(TIME,CYCLE)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   512
  __DECLARE_VAR(BOOL,BUSY)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   513
  __DECLARE_VAR(REAL,XOUT)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   514
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   515
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   516
  __DECLARE_VAR(REAL,XI)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   517
  __DECLARE_VAR(TIME,T)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   518
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   519
} RAMP;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   520
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   521
// FUNCTION_BLOCK RTC
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   522
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   523
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   524
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   525
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   526
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   527
  __DECLARE_VAR(BOOL,IN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   528
  __DECLARE_VAR(DT,PDT)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   529
  __DECLARE_VAR(BOOL,Q)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   530
  __DECLARE_VAR(DT,CDT)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   531
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   532
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   533
  __DECLARE_VAR(BOOL,PREV_IN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   534
  __DECLARE_VAR(TIME,OFFSET)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   535
  __DECLARE_VAR(DT,CURRENT_TIME)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   536
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   537
} RTC;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   538
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   539
// FUNCTION_BLOCK SEMA
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   540
// Data part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   541
typedef struct {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   542
  // FB Interface - IN, OUT, IN_OUT variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   543
  __DECLARE_VAR(BOOL,EN)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   544
  __DECLARE_VAR(BOOL,ENO)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   545
  __DECLARE_VAR(BOOL,CLAIM)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   546
  __DECLARE_VAR(BOOL,RELEASE)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   547
  __DECLARE_VAR(BOOL,BUSY)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   548
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   549
  // FB private variables - TEMP, private and located variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   550
  __DECLARE_VAR(BOOL,Q_INTERNAL)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   551
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   552
} SEMA;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   553
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   554
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   555
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   556
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   557
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   558
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   559
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   560
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   561
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   562
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   563
static void R_TRIG_init__(R_TRIG *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   564
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   565
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   566
  __INIT_VAR(data__->CLK,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   567
  __INIT_VAR(data__->Q,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   568
  __INIT_VAR(data__->M,__BOOL_LITERAL(FALSE),1)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   569
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   570
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   571
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   572
static void R_TRIG_body__(R_TRIG *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   573
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   574
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   575
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   576
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   577
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   578
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   579
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   580
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   581
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   582
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   583
  __SET_VAR(data__->,Q,,(__GET_VAR(data__->CLK,) && !(__GET_VAR(data__->M,))));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   584
  __SET_VAR(data__->,M,,__GET_VAR(data__->CLK,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   585
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   586
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   587
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   588
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   589
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   590
} // R_TRIG_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   591
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   592
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   593
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   594
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   595
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   596
static void F_TRIG_init__(F_TRIG *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   597
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   598
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   599
  __INIT_VAR(data__->CLK,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   600
  __INIT_VAR(data__->Q,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   601
  __INIT_VAR(data__->M,__BOOL_LITERAL(FALSE),1)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   602
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   603
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   604
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   605
static void F_TRIG_body__(F_TRIG *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   606
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   607
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   608
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   609
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   610
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   611
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   612
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   613
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   614
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   615
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   616
  __SET_VAR(data__->,Q,,(!(__GET_VAR(data__->CLK,)) && !(__GET_VAR(data__->M,))));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   617
  __SET_VAR(data__->,M,,!(__GET_VAR(data__->CLK,)));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   618
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   619
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   620
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   621
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   622
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   623
} // F_TRIG_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   624
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   625
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   626
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   627
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   628
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   629
static void SR_init__(SR *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   630
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   631
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   632
  __INIT_VAR(data__->S1,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   633
  __INIT_VAR(data__->R,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   634
  __INIT_VAR(data__->Q1,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   635
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   636
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   637
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   638
static void SR_body__(SR *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   639
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   640
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   641
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   642
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   643
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   644
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   645
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   646
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   647
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   648
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   649
  __SET_VAR(data__->,Q1,,(__GET_VAR(data__->S1,) || (!(__GET_VAR(data__->R,)) && __GET_VAR(data__->Q1,))));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   650
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   651
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   652
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   653
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   654
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   655
} // SR_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   656
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   657
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   658
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   659
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   660
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   661
static void RS_init__(RS *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   662
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   663
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   664
  __INIT_VAR(data__->S,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   665
  __INIT_VAR(data__->R1,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   666
  __INIT_VAR(data__->Q1,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   667
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   668
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   669
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   670
static void RS_body__(RS *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   671
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   672
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   673
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   674
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   675
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   676
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   677
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   678
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   679
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   680
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   681
  __SET_VAR(data__->,Q1,,(!(__GET_VAR(data__->R1,)) && (__GET_VAR(data__->S,) || __GET_VAR(data__->Q1,))));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   682
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   683
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   684
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   685
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   686
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   687
} // RS_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   688
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   689
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   690
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   691
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   692
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   693
static void CTU_init__(CTU *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   694
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   695
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   696
  __INIT_VAR(data__->CU,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   697
  __INIT_VAR(data__->R,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   698
  __INIT_VAR(data__->PV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   699
  __INIT_VAR(data__->Q,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   700
  __INIT_VAR(data__->CV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   701
  R_TRIG_init__(&data__->CU_T,retain);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   702
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   703
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   704
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   705
static void CTU_body__(CTU *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   706
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   707
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   708
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   709
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   710
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   711
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   712
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   713
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   714
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   715
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   716
  __SET_VAR(data__->CU_T.,CLK,,__GET_VAR(data__->CU,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   717
  R_TRIG_body__(&data__->CU_T);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   718
  if (__GET_VAR(data__->R,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   719
    __SET_VAR(data__->,CV,,0);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   720
  } else if ((__GET_VAR(data__->CU_T.Q,) && (__GET_VAR(data__->CV,) < __GET_VAR(data__->PV,)))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   721
    __SET_VAR(data__->,CV,,(__GET_VAR(data__->CV,) + 1));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   722
  };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   723
  __SET_VAR(data__->,Q,,(__GET_VAR(data__->CV,) >= __GET_VAR(data__->PV,)));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   724
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   725
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   726
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   727
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   728
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   729
} // CTU_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   730
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   731
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   732
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   733
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   734
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   735
static void CTU_DINT_init__(CTU_DINT *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   736
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   737
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   738
  __INIT_VAR(data__->CU,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   739
  __INIT_VAR(data__->R,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   740
  __INIT_VAR(data__->PV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   741
  __INIT_VAR(data__->Q,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   742
  __INIT_VAR(data__->CV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   743
  R_TRIG_init__(&data__->CU_T,retain);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   744
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   745
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   746
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   747
static void CTU_DINT_body__(CTU_DINT *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   748
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   749
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   750
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   751
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   752
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   753
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   754
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   755
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   756
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   757
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   758
  __SET_VAR(data__->CU_T.,CLK,,__GET_VAR(data__->CU,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   759
  R_TRIG_body__(&data__->CU_T);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   760
  if (__GET_VAR(data__->R,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   761
    __SET_VAR(data__->,CV,,0);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   762
  } else if ((__GET_VAR(data__->CU_T.Q,) && (__GET_VAR(data__->CV,) < __GET_VAR(data__->PV,)))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   763
    __SET_VAR(data__->,CV,,(__GET_VAR(data__->CV,) + 1));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   764
  };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   765
  __SET_VAR(data__->,Q,,(__GET_VAR(data__->CV,) >= __GET_VAR(data__->PV,)));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   766
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   767
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   768
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   769
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   770
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   771
} // CTU_DINT_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   772
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   773
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   774
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   775
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   776
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   777
static void CTU_LINT_init__(CTU_LINT *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   778
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   779
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   780
  __INIT_VAR(data__->CU,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   781
  __INIT_VAR(data__->R,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   782
  __INIT_VAR(data__->PV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   783
  __INIT_VAR(data__->Q,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   784
  __INIT_VAR(data__->CV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   785
  R_TRIG_init__(&data__->CU_T,retain);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   786
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   787
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   788
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   789
static void CTU_LINT_body__(CTU_LINT *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   790
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   791
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   792
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   793
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   794
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   795
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   796
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   797
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   798
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   799
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   800
  __SET_VAR(data__->CU_T.,CLK,,__GET_VAR(data__->CU,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   801
  R_TRIG_body__(&data__->CU_T);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   802
  if (__GET_VAR(data__->R,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   803
    __SET_VAR(data__->,CV,,0);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   804
  } else if ((__GET_VAR(data__->CU_T.Q,) && (__GET_VAR(data__->CV,) < __GET_VAR(data__->PV,)))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   805
    __SET_VAR(data__->,CV,,(__GET_VAR(data__->CV,) + 1));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   806
  };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   807
  __SET_VAR(data__->,Q,,(__GET_VAR(data__->CV,) >= __GET_VAR(data__->PV,)));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   808
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   809
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   810
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   811
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   812
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   813
} // CTU_LINT_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   814
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   815
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   816
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   817
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   818
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   819
static void CTU_UDINT_init__(CTU_UDINT *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   820
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   821
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   822
  __INIT_VAR(data__->CU,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   823
  __INIT_VAR(data__->R,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   824
  __INIT_VAR(data__->PV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   825
  __INIT_VAR(data__->Q,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   826
  __INIT_VAR(data__->CV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   827
  R_TRIG_init__(&data__->CU_T,retain);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   828
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   829
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   830
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   831
static void CTU_UDINT_body__(CTU_UDINT *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   832
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   833
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   834
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   835
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   836
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   837
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   838
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   839
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   840
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   841
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   842
  __SET_VAR(data__->CU_T.,CLK,,__GET_VAR(data__->CU,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   843
  R_TRIG_body__(&data__->CU_T);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   844
  if (__GET_VAR(data__->R,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   845
    __SET_VAR(data__->,CV,,0);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   846
  } else if ((__GET_VAR(data__->CU_T.Q,) && (__GET_VAR(data__->CV,) < __GET_VAR(data__->PV,)))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   847
    __SET_VAR(data__->,CV,,(__GET_VAR(data__->CV,) + 1));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   848
  };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   849
  __SET_VAR(data__->,Q,,(__GET_VAR(data__->CV,) >= __GET_VAR(data__->PV,)));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   850
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   851
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   852
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   853
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   854
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   855
} // CTU_UDINT_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   856
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   857
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   858
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   859
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   860
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   861
static void CTU_ULINT_init__(CTU_ULINT *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   862
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   863
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   864
  __INIT_VAR(data__->CU,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   865
  __INIT_VAR(data__->R,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   866
  __INIT_VAR(data__->PV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   867
  __INIT_VAR(data__->Q,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   868
  __INIT_VAR(data__->CV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   869
  R_TRIG_init__(&data__->CU_T,retain);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   870
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   871
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   872
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   873
static void CTU_ULINT_body__(CTU_ULINT *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   874
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   875
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   876
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   877
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   878
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   879
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   880
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   881
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   882
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   883
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   884
  __SET_VAR(data__->CU_T.,CLK,,__GET_VAR(data__->CU,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   885
  R_TRIG_body__(&data__->CU_T);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   886
  if (__GET_VAR(data__->R,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   887
    __SET_VAR(data__->,CV,,0);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   888
  } else if ((__GET_VAR(data__->CU_T.Q,) && (__GET_VAR(data__->CV,) < __GET_VAR(data__->PV,)))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   889
    __SET_VAR(data__->,CV,,(__GET_VAR(data__->CV,) + 1));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   890
  };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   891
  __SET_VAR(data__->,Q,,(__GET_VAR(data__->CV,) >= __GET_VAR(data__->PV,)));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   892
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   893
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   894
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   895
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   896
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   897
} // CTU_ULINT_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   898
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   899
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   900
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   901
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   902
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   903
static void CTD_init__(CTD *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   904
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   905
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   906
  __INIT_VAR(data__->CD,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   907
  __INIT_VAR(data__->LD,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   908
  __INIT_VAR(data__->PV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   909
  __INIT_VAR(data__->Q,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   910
  __INIT_VAR(data__->CV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   911
  R_TRIG_init__(&data__->CD_T,retain);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   912
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   913
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   914
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   915
static void CTD_body__(CTD *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   916
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   917
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   918
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   919
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   920
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   921
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   922
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   923
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   924
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   925
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   926
  __SET_VAR(data__->CD_T.,CLK,,__GET_VAR(data__->CD,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   927
  R_TRIG_body__(&data__->CD_T);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   928
  if (__GET_VAR(data__->LD,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   929
    __SET_VAR(data__->,CV,,__GET_VAR(data__->PV,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   930
  } else if ((__GET_VAR(data__->CD_T.Q,) && (__GET_VAR(data__->CV,) > 0))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   931
    __SET_VAR(data__->,CV,,(__GET_VAR(data__->CV,) - 1));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   932
  };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   933
  __SET_VAR(data__->,Q,,(__GET_VAR(data__->CV,) <= 0));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   934
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   935
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   936
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   937
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   938
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   939
} // CTD_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   940
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   941
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   942
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   943
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   944
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   945
static void CTD_DINT_init__(CTD_DINT *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   946
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   947
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   948
  __INIT_VAR(data__->CD,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   949
  __INIT_VAR(data__->LD,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   950
  __INIT_VAR(data__->PV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   951
  __INIT_VAR(data__->Q,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   952
  __INIT_VAR(data__->CV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   953
  R_TRIG_init__(&data__->CD_T,retain);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   954
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   955
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   956
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   957
static void CTD_DINT_body__(CTD_DINT *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   958
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   959
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   960
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   961
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   962
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   963
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   964
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   965
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   966
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   967
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   968
  __SET_VAR(data__->CD_T.,CLK,,__GET_VAR(data__->CD,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   969
  R_TRIG_body__(&data__->CD_T);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   970
  if (__GET_VAR(data__->LD,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   971
    __SET_VAR(data__->,CV,,__GET_VAR(data__->PV,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   972
  } else if ((__GET_VAR(data__->CD_T.Q,) && (__GET_VAR(data__->CV,) > 0))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   973
    __SET_VAR(data__->,CV,,(__GET_VAR(data__->CV,) - 1));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   974
  };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   975
  __SET_VAR(data__->,Q,,(__GET_VAR(data__->CV,) <= 0));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   976
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   977
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   978
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   979
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   980
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   981
} // CTD_DINT_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   982
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   983
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   984
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   985
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   986
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   987
static void CTD_LINT_init__(CTD_LINT *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   988
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   989
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   990
  __INIT_VAR(data__->CD,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   991
  __INIT_VAR(data__->LD,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   992
  __INIT_VAR(data__->PV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   993
  __INIT_VAR(data__->Q,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   994
  __INIT_VAR(data__->CV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   995
  R_TRIG_init__(&data__->CD_T,retain);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   996
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   997
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   998
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
   999
static void CTD_LINT_body__(CTD_LINT *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1000
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1001
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1002
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1003
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1004
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1005
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1006
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1007
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1008
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1009
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1010
  __SET_VAR(data__->CD_T.,CLK,,__GET_VAR(data__->CD,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1011
  R_TRIG_body__(&data__->CD_T);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1012
  if (__GET_VAR(data__->LD,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1013
    __SET_VAR(data__->,CV,,__GET_VAR(data__->PV,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1014
  } else if ((__GET_VAR(data__->CD_T.Q,) && (__GET_VAR(data__->CV,) > 0))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1015
    __SET_VAR(data__->,CV,,(__GET_VAR(data__->CV,) - 1));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1016
  };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1017
  __SET_VAR(data__->,Q,,(__GET_VAR(data__->CV,) <= 0));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1018
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1019
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1020
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1021
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1022
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1023
} // CTD_LINT_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1024
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1025
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1026
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1027
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1028
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1029
static void CTD_UDINT_init__(CTD_UDINT *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1030
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1031
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1032
  __INIT_VAR(data__->CD,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1033
  __INIT_VAR(data__->LD,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1034
  __INIT_VAR(data__->PV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1035
  __INIT_VAR(data__->Q,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1036
  __INIT_VAR(data__->CV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1037
  R_TRIG_init__(&data__->CD_T,retain);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1038
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1039
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1040
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1041
static void CTD_UDINT_body__(CTD_UDINT *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1042
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1043
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1044
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1045
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1046
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1047
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1048
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1049
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1050
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1051
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1052
  __SET_VAR(data__->CD_T.,CLK,,__GET_VAR(data__->CD,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1053
  R_TRIG_body__(&data__->CD_T);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1054
  if (__GET_VAR(data__->LD,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1055
    __SET_VAR(data__->,CV,,__GET_VAR(data__->PV,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1056
  } else if ((__GET_VAR(data__->CD_T.Q,) && (__GET_VAR(data__->CV,) > 0))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1057
    __SET_VAR(data__->,CV,,(__GET_VAR(data__->CV,) - 1));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1058
  };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1059
  __SET_VAR(data__->,Q,,(__GET_VAR(data__->CV,) <= 0));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1060
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1061
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1062
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1063
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1064
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1065
} // CTD_UDINT_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1066
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1067
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1068
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1069
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1070
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1071
static void CTD_ULINT_init__(CTD_ULINT *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1072
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1073
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1074
  __INIT_VAR(data__->CD,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1075
  __INIT_VAR(data__->LD,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1076
  __INIT_VAR(data__->PV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1077
  __INIT_VAR(data__->Q,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1078
  __INIT_VAR(data__->CV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1079
  R_TRIG_init__(&data__->CD_T,retain);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1080
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1081
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1082
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1083
static void CTD_ULINT_body__(CTD_ULINT *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1084
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1085
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1086
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1087
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1088
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1089
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1090
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1091
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1092
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1093
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1094
  __SET_VAR(data__->CD_T.,CLK,,__GET_VAR(data__->CD,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1095
  R_TRIG_body__(&data__->CD_T);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1096
  if (__GET_VAR(data__->LD,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1097
    __SET_VAR(data__->,CV,,__GET_VAR(data__->PV,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1098
  } else if ((__GET_VAR(data__->CD_T.Q,) && (__GET_VAR(data__->CV,) > 0))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1099
    __SET_VAR(data__->,CV,,(__GET_VAR(data__->CV,) - 1));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1100
  };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1101
  __SET_VAR(data__->,Q,,(__GET_VAR(data__->CV,) <= 0));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1102
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1103
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1104
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1105
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1106
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1107
} // CTD_ULINT_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1108
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1109
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1110
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1111
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1112
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1113
static void CTUD_init__(CTUD *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1114
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1115
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1116
  __INIT_VAR(data__->CU,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1117
  __INIT_VAR(data__->CD,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1118
  __INIT_VAR(data__->R,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1119
  __INIT_VAR(data__->LD,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1120
  __INIT_VAR(data__->PV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1121
  __INIT_VAR(data__->QU,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1122
  __INIT_VAR(data__->QD,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1123
  __INIT_VAR(data__->CV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1124
  R_TRIG_init__(&data__->CD_T,retain);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1125
  R_TRIG_init__(&data__->CU_T,retain);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1126
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1127
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1128
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1129
static void CTUD_body__(CTUD *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1130
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1131
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1132
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1133
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1134
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1135
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1136
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1137
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1138
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1139
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1140
  __SET_VAR(data__->CD_T.,CLK,,__GET_VAR(data__->CD,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1141
  R_TRIG_body__(&data__->CD_T);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1142
  __SET_VAR(data__->CU_T.,CLK,,__GET_VAR(data__->CU,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1143
  R_TRIG_body__(&data__->CU_T);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1144
  if (__GET_VAR(data__->R,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1145
    __SET_VAR(data__->,CV,,0);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1146
  } else if (__GET_VAR(data__->LD,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1147
    __SET_VAR(data__->,CV,,__GET_VAR(data__->PV,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1148
  } else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1149
    if (!((__GET_VAR(data__->CU_T.Q,) && __GET_VAR(data__->CD_T.Q,)))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1150
      if ((__GET_VAR(data__->CU_T.Q,) && (__GET_VAR(data__->CV,) < __GET_VAR(data__->PV,)))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1151
        __SET_VAR(data__->,CV,,(__GET_VAR(data__->CV,) + 1));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1152
      } else if ((__GET_VAR(data__->CD_T.Q,) && (__GET_VAR(data__->CV,) > 0))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1153
        __SET_VAR(data__->,CV,,(__GET_VAR(data__->CV,) - 1));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1154
      };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1155
    };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1156
  };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1157
  __SET_VAR(data__->,QU,,(__GET_VAR(data__->CV,) >= __GET_VAR(data__->PV,)));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1158
  __SET_VAR(data__->,QD,,(__GET_VAR(data__->CV,) <= 0));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1159
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1160
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1161
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1162
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1163
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1164
} // CTUD_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1165
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1166
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1167
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1168
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1169
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1170
static void CTUD_DINT_init__(CTUD_DINT *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1171
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1172
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1173
  __INIT_VAR(data__->CU,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1174
  __INIT_VAR(data__->CD,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1175
  __INIT_VAR(data__->R,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1176
  __INIT_VAR(data__->LD,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1177
  __INIT_VAR(data__->PV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1178
  __INIT_VAR(data__->QU,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1179
  __INIT_VAR(data__->QD,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1180
  __INIT_VAR(data__->CV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1181
  R_TRIG_init__(&data__->CD_T,retain);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1182
  R_TRIG_init__(&data__->CU_T,retain);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1183
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1184
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1185
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1186
static void CTUD_DINT_body__(CTUD_DINT *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1187
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1188
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1189
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1190
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1191
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1192
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1193
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1194
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1195
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1196
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1197
  __SET_VAR(data__->CD_T.,CLK,,__GET_VAR(data__->CD,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1198
  R_TRIG_body__(&data__->CD_T);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1199
  __SET_VAR(data__->CU_T.,CLK,,__GET_VAR(data__->CU,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1200
  R_TRIG_body__(&data__->CU_T);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1201
  if (__GET_VAR(data__->R,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1202
    __SET_VAR(data__->,CV,,0);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1203
  } else if (__GET_VAR(data__->LD,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1204
    __SET_VAR(data__->,CV,,__GET_VAR(data__->PV,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1205
  } else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1206
    if (!((__GET_VAR(data__->CU_T.Q,) && __GET_VAR(data__->CD_T.Q,)))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1207
      if ((__GET_VAR(data__->CU_T.Q,) && (__GET_VAR(data__->CV,) < __GET_VAR(data__->PV,)))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1208
        __SET_VAR(data__->,CV,,(__GET_VAR(data__->CV,) + 1));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1209
      } else if ((__GET_VAR(data__->CD_T.Q,) && (__GET_VAR(data__->CV,) > 0))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1210
        __SET_VAR(data__->,CV,,(__GET_VAR(data__->CV,) - 1));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1211
      };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1212
    };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1213
  };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1214
  __SET_VAR(data__->,QU,,(__GET_VAR(data__->CV,) >= __GET_VAR(data__->PV,)));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1215
  __SET_VAR(data__->,QD,,(__GET_VAR(data__->CV,) <= 0));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1216
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1217
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1218
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1219
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1220
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1221
} // CTUD_DINT_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1222
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1223
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1224
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1225
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1226
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1227
static void CTUD_LINT_init__(CTUD_LINT *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1228
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1229
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1230
  __INIT_VAR(data__->CU,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1231
  __INIT_VAR(data__->CD,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1232
  __INIT_VAR(data__->R,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1233
  __INIT_VAR(data__->LD,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1234
  __INIT_VAR(data__->PV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1235
  __INIT_VAR(data__->QU,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1236
  __INIT_VAR(data__->QD,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1237
  __INIT_VAR(data__->CV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1238
  R_TRIG_init__(&data__->CD_T,retain);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1239
  R_TRIG_init__(&data__->CU_T,retain);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1240
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1241
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1242
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1243
static void CTUD_LINT_body__(CTUD_LINT *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1244
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1245
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1246
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1247
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1248
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1249
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1250
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1251
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1252
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1253
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1254
  __SET_VAR(data__->CD_T.,CLK,,__GET_VAR(data__->CD,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1255
  R_TRIG_body__(&data__->CD_T);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1256
  __SET_VAR(data__->CU_T.,CLK,,__GET_VAR(data__->CU,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1257
  R_TRIG_body__(&data__->CU_T);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1258
  if (__GET_VAR(data__->R,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1259
    __SET_VAR(data__->,CV,,0);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1260
  } else if (__GET_VAR(data__->LD,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1261
    __SET_VAR(data__->,CV,,__GET_VAR(data__->PV,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1262
  } else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1263
    if (!((__GET_VAR(data__->CU_T.Q,) && __GET_VAR(data__->CD_T.Q,)))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1264
      if ((__GET_VAR(data__->CU_T.Q,) && (__GET_VAR(data__->CV,) < __GET_VAR(data__->PV,)))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1265
        __SET_VAR(data__->,CV,,(__GET_VAR(data__->CV,) + 1));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1266
      } else if ((__GET_VAR(data__->CD_T.Q,) && (__GET_VAR(data__->CV,) > 0))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1267
        __SET_VAR(data__->,CV,,(__GET_VAR(data__->CV,) - 1));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1268
      };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1269
    };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1270
  };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1271
  __SET_VAR(data__->,QU,,(__GET_VAR(data__->CV,) >= __GET_VAR(data__->PV,)));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1272
  __SET_VAR(data__->,QD,,(__GET_VAR(data__->CV,) <= 0));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1273
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1274
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1275
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1276
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1277
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1278
} // CTUD_LINT_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1279
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1280
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1281
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1282
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1283
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1284
static void CTUD_UDINT_init__(CTUD_UDINT *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1285
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1286
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1287
  __INIT_VAR(data__->CU,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1288
  __INIT_VAR(data__->CD,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1289
  __INIT_VAR(data__->R,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1290
  __INIT_VAR(data__->LD,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1291
  __INIT_VAR(data__->PV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1292
  __INIT_VAR(data__->QU,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1293
  __INIT_VAR(data__->QD,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1294
  __INIT_VAR(data__->CV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1295
  R_TRIG_init__(&data__->CD_T,retain);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1296
  R_TRIG_init__(&data__->CU_T,retain);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1297
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1298
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1299
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1300
static void CTUD_UDINT_body__(CTUD_UDINT *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1301
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1302
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1303
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1304
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1305
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1306
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1307
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1308
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1309
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1310
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1311
  __SET_VAR(data__->CD_T.,CLK,,__GET_VAR(data__->CD,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1312
  R_TRIG_body__(&data__->CD_T);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1313
  __SET_VAR(data__->CU_T.,CLK,,__GET_VAR(data__->CU,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1314
  R_TRIG_body__(&data__->CU_T);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1315
  if (__GET_VAR(data__->R,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1316
    __SET_VAR(data__->,CV,,0);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1317
  } else if (__GET_VAR(data__->LD,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1318
    __SET_VAR(data__->,CV,,__GET_VAR(data__->PV,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1319
  } else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1320
    if (!((__GET_VAR(data__->CU_T.Q,) && __GET_VAR(data__->CD_T.Q,)))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1321
      if ((__GET_VAR(data__->CU_T.Q,) && (__GET_VAR(data__->CV,) < __GET_VAR(data__->PV,)))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1322
        __SET_VAR(data__->,CV,,(__GET_VAR(data__->CV,) + 1));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1323
      } else if ((__GET_VAR(data__->CD_T.Q,) && (__GET_VAR(data__->CV,) > 0))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1324
        __SET_VAR(data__->,CV,,(__GET_VAR(data__->CV,) - 1));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1325
      };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1326
    };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1327
  };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1328
  __SET_VAR(data__->,QU,,(__GET_VAR(data__->CV,) >= __GET_VAR(data__->PV,)));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1329
  __SET_VAR(data__->,QD,,(__GET_VAR(data__->CV,) <= 0));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1330
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1331
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1332
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1333
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1334
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1335
} // CTUD_UDINT_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1336
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1337
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1338
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1339
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1340
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1341
static void CTUD_ULINT_init__(CTUD_ULINT *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1342
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1343
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1344
  __INIT_VAR(data__->CU,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1345
  __INIT_VAR(data__->CD,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1346
  __INIT_VAR(data__->R,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1347
  __INIT_VAR(data__->LD,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1348
  __INIT_VAR(data__->PV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1349
  __INIT_VAR(data__->QU,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1350
  __INIT_VAR(data__->QD,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1351
  __INIT_VAR(data__->CV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1352
  R_TRIG_init__(&data__->CD_T,retain);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1353
  R_TRIG_init__(&data__->CU_T,retain);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1354
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1355
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1356
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1357
static void CTUD_ULINT_body__(CTUD_ULINT *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1358
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1359
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1360
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1361
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1362
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1363
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1364
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1365
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1366
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1367
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1368
  __SET_VAR(data__->CD_T.,CLK,,__GET_VAR(data__->CD,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1369
  R_TRIG_body__(&data__->CD_T);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1370
  __SET_VAR(data__->CU_T.,CLK,,__GET_VAR(data__->CU,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1371
  R_TRIG_body__(&data__->CU_T);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1372
  if (__GET_VAR(data__->R,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1373
    __SET_VAR(data__->,CV,,0);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1374
  } else if (__GET_VAR(data__->LD,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1375
    __SET_VAR(data__->,CV,,__GET_VAR(data__->PV,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1376
  } else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1377
    if (!((__GET_VAR(data__->CU_T.Q,) && __GET_VAR(data__->CD_T.Q,)))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1378
      if ((__GET_VAR(data__->CU_T.Q,) && (__GET_VAR(data__->CV,) < __GET_VAR(data__->PV,)))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1379
        __SET_VAR(data__->,CV,,(__GET_VAR(data__->CV,) + 1));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1380
      } else if ((__GET_VAR(data__->CD_T.Q,) && (__GET_VAR(data__->CV,) > 0))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1381
        __SET_VAR(data__->,CV,,(__GET_VAR(data__->CV,) - 1));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1382
      };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1383
    };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1384
  };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1385
  __SET_VAR(data__->,QU,,(__GET_VAR(data__->CV,) >= __GET_VAR(data__->PV,)));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1386
  __SET_VAR(data__->,QD,,(__GET_VAR(data__->CV,) <= 0));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1387
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1388
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1389
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1390
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1391
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1392
} // CTUD_ULINT_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1393
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1394
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1395
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1396
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1397
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1398
static void TP_init__(TP *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1399
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1400
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1401
  __INIT_VAR(data__->IN,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1402
  __INIT_VAR(data__->PT,__time_to_timespec(1, 0, 0, 0, 0, 0),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1403
  __INIT_VAR(data__->Q,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1404
  __INIT_VAR(data__->ET,__time_to_timespec(1, 0, 0, 0, 0, 0),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1405
  __INIT_VAR(data__->STATE,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1406
  __INIT_VAR(data__->PREV_IN,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1407
  __INIT_VAR(data__->CURRENT_TIME,__time_to_timespec(1, 0, 0, 0, 0, 0),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1408
  __INIT_VAR(data__->START_TIME,__time_to_timespec(1, 0, 0, 0, 0, 0),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1409
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1410
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1411
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1412
static void TP_body__(TP *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1413
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1414
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1415
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1416
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1417
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1418
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1419
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1420
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1421
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1422
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1423
  #define GetFbVar(var,...) __GET_VAR(data__->var,__VA_ARGS__)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1424
  #define SetFbVar(var,val,...) __SET_VAR(data__->,var,__VA_ARGS__,val)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1425
__SET_VAR(data__->,CURRENT_TIME,,__CURRENT_TIME)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1426
  #undef GetFbVar
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1427
  #undef SetFbVar
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1428
;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1429
  if ((((__GET_VAR(data__->STATE,) == 0) && !(__GET_VAR(data__->PREV_IN,))) && __GET_VAR(data__->IN,))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1430
    __SET_VAR(data__->,STATE,,1);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1431
    __SET_VAR(data__->,Q,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1432
    __SET_VAR(data__->,START_TIME,,__GET_VAR(data__->CURRENT_TIME,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1433
  } else if ((__GET_VAR(data__->STATE,) == 1)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1434
    if (LE_TIME(__BOOL_LITERAL(TRUE), NULL, 2, __time_add(__GET_VAR(data__->START_TIME,), __GET_VAR(data__->PT,)), __GET_VAR(data__->CURRENT_TIME,))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1435
      __SET_VAR(data__->,STATE,,2);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1436
      __SET_VAR(data__->,Q,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1437
      __SET_VAR(data__->,ET,,__GET_VAR(data__->PT,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1438
    } else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1439
      __SET_VAR(data__->,ET,,__time_sub(__GET_VAR(data__->CURRENT_TIME,), __GET_VAR(data__->START_TIME,)));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1440
    };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1441
  };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1442
  if (((__GET_VAR(data__->STATE,) == 2) && !(__GET_VAR(data__->IN,)))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1443
    __SET_VAR(data__->,ET,,__time_to_timespec(1, 0, 0, 0, 0, 0));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1444
    __SET_VAR(data__->,STATE,,0);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1445
  };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1446
  __SET_VAR(data__->,PREV_IN,,__GET_VAR(data__->IN,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1447
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1448
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1449
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1450
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1451
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1452
} // TP_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1453
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1454
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1455
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1456
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1457
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1458
static void TON_init__(TON *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1459
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1460
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1461
  __INIT_VAR(data__->IN,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1462
  __INIT_VAR(data__->PT,__time_to_timespec(1, 0, 0, 0, 0, 0),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1463
  __INIT_VAR(data__->Q,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1464
  __INIT_VAR(data__->ET,__time_to_timespec(1, 0, 0, 0, 0, 0),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1465
  __INIT_VAR(data__->STATE,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1466
  __INIT_VAR(data__->PREV_IN,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1467
  __INIT_VAR(data__->CURRENT_TIME,__time_to_timespec(1, 0, 0, 0, 0, 0),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1468
  __INIT_VAR(data__->START_TIME,__time_to_timespec(1, 0, 0, 0, 0, 0),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1469
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1470
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1471
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1472
static void TON_body__(TON *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1473
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1474
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1475
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1476
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1477
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1478
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1479
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1480
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1481
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1482
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1483
  #define GetFbVar(var,...) __GET_VAR(data__->var,__VA_ARGS__)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1484
  #define SetFbVar(var,val,...) __SET_VAR(data__->,var,__VA_ARGS__,val)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1485
__SET_VAR(data__->,CURRENT_TIME,,__CURRENT_TIME)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1486
  #undef GetFbVar
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1487
  #undef SetFbVar
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1488
;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1489
  if ((((__GET_VAR(data__->STATE,) == 0) && !(__GET_VAR(data__->PREV_IN,))) && __GET_VAR(data__->IN,))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1490
    __SET_VAR(data__->,STATE,,1);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1491
    __SET_VAR(data__->,Q,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1492
    __SET_VAR(data__->,START_TIME,,__GET_VAR(data__->CURRENT_TIME,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1493
  } else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1494
    if (!(__GET_VAR(data__->IN,))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1495
      __SET_VAR(data__->,ET,,__time_to_timespec(1, 0, 0, 0, 0, 0));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1496
      __SET_VAR(data__->,Q,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1497
      __SET_VAR(data__->,STATE,,0);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1498
    } else if ((__GET_VAR(data__->STATE,) == 1)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1499
      if (LE_TIME(__BOOL_LITERAL(TRUE), NULL, 2, __time_add(__GET_VAR(data__->START_TIME,), __GET_VAR(data__->PT,)), __GET_VAR(data__->CURRENT_TIME,))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1500
        __SET_VAR(data__->,STATE,,2);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1501
        __SET_VAR(data__->,Q,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1502
        __SET_VAR(data__->,ET,,__GET_VAR(data__->PT,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1503
      } else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1504
        __SET_VAR(data__->,ET,,__time_sub(__GET_VAR(data__->CURRENT_TIME,), __GET_VAR(data__->START_TIME,)));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1505
      };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1506
    };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1507
  };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1508
  __SET_VAR(data__->,PREV_IN,,__GET_VAR(data__->IN,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1509
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1510
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1511
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1512
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1513
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1514
} // TON_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1515
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1516
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1517
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1518
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1519
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1520
static void TOF_init__(TOF *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1521
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1522
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1523
  __INIT_VAR(data__->IN,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1524
  __INIT_VAR(data__->PT,__time_to_timespec(1, 0, 0, 0, 0, 0),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1525
  __INIT_VAR(data__->Q,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1526
  __INIT_VAR(data__->ET,__time_to_timespec(1, 0, 0, 0, 0, 0),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1527
  __INIT_VAR(data__->STATE,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1528
  __INIT_VAR(data__->PREV_IN,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1529
  __INIT_VAR(data__->CURRENT_TIME,__time_to_timespec(1, 0, 0, 0, 0, 0),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1530
  __INIT_VAR(data__->START_TIME,__time_to_timespec(1, 0, 0, 0, 0, 0),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1531
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1532
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1533
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1534
static void TOF_body__(TOF *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1535
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1536
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1537
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1538
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1539
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1540
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1541
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1542
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1543
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1544
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1545
  #define GetFbVar(var,...) __GET_VAR(data__->var,__VA_ARGS__)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1546
  #define SetFbVar(var,val,...) __SET_VAR(data__->,var,__VA_ARGS__,val)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1547
__SET_VAR(data__->,CURRENT_TIME,,__CURRENT_TIME)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1548
  #undef GetFbVar
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1549
  #undef SetFbVar
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1550
;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1551
  if ((((__GET_VAR(data__->STATE,) == 0) && __GET_VAR(data__->PREV_IN,)) && !(__GET_VAR(data__->IN,)))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1552
    __SET_VAR(data__->,STATE,,1);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1553
    __SET_VAR(data__->,START_TIME,,__GET_VAR(data__->CURRENT_TIME,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1554
  } else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1555
    if (__GET_VAR(data__->IN,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1556
      __SET_VAR(data__->,ET,,__time_to_timespec(1, 0, 0, 0, 0, 0));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1557
      __SET_VAR(data__->,STATE,,0);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1558
    } else if ((__GET_VAR(data__->STATE,) == 1)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1559
      if (LE_TIME(__BOOL_LITERAL(TRUE), NULL, 2, __time_add(__GET_VAR(data__->START_TIME,), __GET_VAR(data__->PT,)), __GET_VAR(data__->CURRENT_TIME,))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1560
        __SET_VAR(data__->,STATE,,2);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1561
        __SET_VAR(data__->,ET,,__GET_VAR(data__->PT,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1562
      } else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1563
        __SET_VAR(data__->,ET,,__time_sub(__GET_VAR(data__->CURRENT_TIME,), __GET_VAR(data__->START_TIME,)));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1564
      };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1565
    };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1566
  };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1567
  __SET_VAR(data__->,Q,,(__GET_VAR(data__->IN,) || (__GET_VAR(data__->STATE,) == 1)));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1568
  __SET_VAR(data__->,PREV_IN,,__GET_VAR(data__->IN,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1569
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1570
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1571
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1572
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1573
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1574
} // TOF_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1575
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1576
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1577
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1578
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1579
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1580
static void DERIVATIVE_init__(DERIVATIVE *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1581
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1582
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1583
  __INIT_VAR(data__->RUN,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1584
  __INIT_VAR(data__->XIN,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1585
  __INIT_VAR(data__->CYCLE,__time_to_timespec(1, 0, 0, 0, 0, 0),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1586
  __INIT_VAR(data__->XOUT,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1587
  __INIT_VAR(data__->X1,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1588
  __INIT_VAR(data__->X2,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1589
  __INIT_VAR(data__->X3,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1590
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1591
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1592
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1593
static void DERIVATIVE_body__(DERIVATIVE *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1594
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1595
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1596
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1597
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1598
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1599
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1600
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1601
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1602
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1603
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1604
  if (__GET_VAR(data__->RUN,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1605
    __SET_VAR(data__->,XOUT,,((((3.0 * (__GET_VAR(data__->XIN,) - __GET_VAR(data__->X3,))) + __GET_VAR(data__->X1,)) - __GET_VAR(data__->X2,)) / (10.0 * TIME_TO_REAL((BOOL)__BOOL_LITERAL(TRUE),
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1606
      NULL,
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1607
      (TIME)__GET_VAR(data__->CYCLE,)))));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1608
    __SET_VAR(data__->,X3,,__GET_VAR(data__->X2,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1609
    __SET_VAR(data__->,X2,,__GET_VAR(data__->X1,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1610
    __SET_VAR(data__->,X1,,__GET_VAR(data__->XIN,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1611
  } else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1612
    __SET_VAR(data__->,XOUT,,0.0);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1613
    __SET_VAR(data__->,X1,,__GET_VAR(data__->XIN,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1614
    __SET_VAR(data__->,X2,,__GET_VAR(data__->XIN,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1615
    __SET_VAR(data__->,X3,,__GET_VAR(data__->XIN,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1616
  };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1617
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1618
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1619
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1620
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1621
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1622
} // DERIVATIVE_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1623
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1624
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1625
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1626
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1627
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1628
static void HYSTERESIS_init__(HYSTERESIS *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1629
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1630
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1631
  __INIT_VAR(data__->XIN1,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1632
  __INIT_VAR(data__->XIN2,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1633
  __INIT_VAR(data__->EPS,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1634
  __INIT_VAR(data__->Q,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1635
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1636
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1637
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1638
static void HYSTERESIS_body__(HYSTERESIS *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1639
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1640
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1641
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1642
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1643
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1644
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1645
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1646
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1647
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1648
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1649
  if (__GET_VAR(data__->Q,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1650
    if ((__GET_VAR(data__->XIN1,) < (__GET_VAR(data__->XIN2,) - __GET_VAR(data__->EPS,)))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1651
      __SET_VAR(data__->,Q,,0);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1652
    };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1653
  } else if ((__GET_VAR(data__->XIN1,) > (__GET_VAR(data__->XIN2,) + __GET_VAR(data__->EPS,)))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1654
    __SET_VAR(data__->,Q,,1);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1655
  };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1656
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1657
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1658
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1659
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1660
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1661
} // HYSTERESIS_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1662
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1663
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1664
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1665
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1666
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1667
static void INTEGRAL_init__(INTEGRAL *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1668
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1669
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1670
  __INIT_VAR(data__->RUN,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1671
  __INIT_VAR(data__->R1,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1672
  __INIT_VAR(data__->XIN,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1673
  __INIT_VAR(data__->X0,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1674
  __INIT_VAR(data__->CYCLE,__time_to_timespec(1, 0, 0, 0, 0, 0),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1675
  __INIT_VAR(data__->Q,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1676
  __INIT_VAR(data__->XOUT,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1677
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1678
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1679
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1680
static void INTEGRAL_body__(INTEGRAL *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1681
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1682
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1683
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1684
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1685
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1686
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1687
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1688
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1689
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1690
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1691
  __SET_VAR(data__->,Q,,!(__GET_VAR(data__->R1,)));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1692
  if (__GET_VAR(data__->R1,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1693
    __SET_VAR(data__->,XOUT,,__GET_VAR(data__->X0,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1694
  } else if (__GET_VAR(data__->RUN,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1695
    __SET_VAR(data__->,XOUT,,(__GET_VAR(data__->XOUT,) + (__GET_VAR(data__->XIN,) * TIME_TO_REAL((BOOL)__BOOL_LITERAL(TRUE),
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1696
      NULL,
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1697
      (TIME)__GET_VAR(data__->CYCLE,)))));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1698
  };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1699
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1700
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1701
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1702
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1703
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1704
} // INTEGRAL_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1705
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1706
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1707
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1708
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1709
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1710
static void PID_init__(PID *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1711
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1712
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1713
  __INIT_VAR(data__->AUTO,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1714
  __INIT_VAR(data__->PV,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1715
  __INIT_VAR(data__->SP,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1716
  __INIT_VAR(data__->X0,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1717
  __INIT_VAR(data__->KP,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1718
  __INIT_VAR(data__->TR,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1719
  __INIT_VAR(data__->TD,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1720
  __INIT_VAR(data__->CYCLE,__time_to_timespec(1, 0, 0, 0, 0, 0),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1721
  __INIT_VAR(data__->XOUT,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1722
  __INIT_VAR(data__->ERROR,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1723
  INTEGRAL_init__(&data__->ITERM,retain);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1724
  DERIVATIVE_init__(&data__->DTERM,retain);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1725
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1726
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1727
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1728
static void PID_body__(PID *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1729
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1730
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1731
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1732
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1733
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1734
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1735
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1736
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1737
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1738
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1739
  __SET_VAR(data__->,ERROR,,(__GET_VAR(data__->PV,) - __GET_VAR(data__->SP,)));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1740
  __SET_VAR(data__->ITERM.,RUN,,__GET_VAR(data__->AUTO,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1741
  __SET_VAR(data__->ITERM.,R1,,!(__GET_VAR(data__->AUTO,)));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1742
  __SET_VAR(data__->ITERM.,XIN,,__GET_VAR(data__->ERROR,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1743
  __SET_VAR(data__->ITERM.,X0,,(__GET_VAR(data__->TR,) * (__GET_VAR(data__->X0,) - __GET_VAR(data__->ERROR,))));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1744
  __SET_VAR(data__->ITERM.,CYCLE,,__GET_VAR(data__->CYCLE,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1745
  INTEGRAL_body__(&data__->ITERM);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1746
  __SET_VAR(data__->DTERM.,RUN,,__GET_VAR(data__->AUTO,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1747
  __SET_VAR(data__->DTERM.,XIN,,__GET_VAR(data__->ERROR,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1748
  __SET_VAR(data__->DTERM.,CYCLE,,__GET_VAR(data__->CYCLE,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1749
  DERIVATIVE_body__(&data__->DTERM);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1750
  __SET_VAR(data__->,XOUT,,(__GET_VAR(data__->KP,) * ((__GET_VAR(data__->ERROR,) + (__GET_VAR(data__->ITERM.XOUT,) / __GET_VAR(data__->TR,))) + (__GET_VAR(data__->DTERM.XOUT,) * __GET_VAR(data__->TD,)))));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1751
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1752
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1753
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1754
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1755
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1756
} // PID_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1757
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1758
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1759
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1760
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1761
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1762
static void RAMP_init__(RAMP *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1763
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1764
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1765
  __INIT_VAR(data__->RUN,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1766
  __INIT_VAR(data__->X0,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1767
  __INIT_VAR(data__->X1,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1768
  __INIT_VAR(data__->TR,__time_to_timespec(1, 0, 0, 0, 0, 0),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1769
  __INIT_VAR(data__->CYCLE,__time_to_timespec(1, 0, 0, 0, 0, 0),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1770
  __INIT_VAR(data__->BUSY,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1771
  __INIT_VAR(data__->XOUT,0.0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1772
  __INIT_VAR(data__->XI,0,retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1773
  __INIT_VAR(data__->T,__time_to_timespec(1, 0, 0, 0, 0, 0),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1774
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1775
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1776
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1777
static void RAMP_body__(RAMP *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1778
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1779
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1780
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1781
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1782
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1783
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1784
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1785
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1786
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1787
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1788
  __SET_VAR(data__->,BUSY,,__GET_VAR(data__->RUN,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1789
  if (__GET_VAR(data__->RUN,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1790
    if (GE_TIME(__BOOL_LITERAL(TRUE), NULL, 2, __GET_VAR(data__->T,), __GET_VAR(data__->TR,))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1791
      __SET_VAR(data__->,BUSY,,0);
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1792
      __SET_VAR(data__->,XOUT,,__GET_VAR(data__->X1,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1793
    } else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1794
      __SET_VAR(data__->,XOUT,,(__GET_VAR(data__->XI,) + (((__GET_VAR(data__->X1,) - __GET_VAR(data__->XI,)) * TIME_TO_REAL((BOOL)__BOOL_LITERAL(TRUE),
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1795
        NULL,
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1796
        (TIME)__GET_VAR(data__->T,))) / TIME_TO_REAL((BOOL)__BOOL_LITERAL(TRUE),
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1797
        NULL,
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1798
        (TIME)__GET_VAR(data__->TR,)))));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1799
      __SET_VAR(data__->,T,,__time_add(__GET_VAR(data__->T,), __GET_VAR(data__->CYCLE,)));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1800
    };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1801
  } else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1802
    __SET_VAR(data__->,XOUT,,__GET_VAR(data__->X0,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1803
    __SET_VAR(data__->,XI,,__GET_VAR(data__->X0,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1804
    __SET_VAR(data__->,T,,__time_to_timespec(1, 0, 0, 0, 0, 0));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1805
  };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1806
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1807
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1808
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1809
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1810
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1811
} // RAMP_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1812
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1813
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1814
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1815
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1816
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1817
static void RTC_init__(RTC *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1818
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1819
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1820
  __INIT_VAR(data__->IN,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1821
  __INIT_VAR(data__->PDT,__dt_to_timespec(0, 0, 0, 1, 1, 1970),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1822
  __INIT_VAR(data__->Q,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1823
  __INIT_VAR(data__->CDT,__dt_to_timespec(0, 0, 0, 1, 1, 1970),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1824
  __INIT_VAR(data__->PREV_IN,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1825
  __INIT_VAR(data__->OFFSET,__time_to_timespec(1, 0, 0, 0, 0, 0),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1826
  __INIT_VAR(data__->CURRENT_TIME,__dt_to_timespec(0, 0, 0, 1, 1, 1970),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1827
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1828
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1829
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1830
static void RTC_body__(RTC *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1831
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1832
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1833
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1834
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1835
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1836
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1837
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1838
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1839
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1840
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1841
  #define GetFbVar(var,...) __GET_VAR(data__->var,__VA_ARGS__)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1842
  #define SetFbVar(var,val,...) __SET_VAR(data__->,var,__VA_ARGS__,val)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1843
__SET_VAR(data__->,CURRENT_TIME,,__CURRENT_TIME)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1844
  #undef GetFbVar
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1845
  #undef SetFbVar
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1846
;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1847
  if (__GET_VAR(data__->IN,)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1848
    if (!(__GET_VAR(data__->PREV_IN,))) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1849
      __SET_VAR(data__->,OFFSET,,__time_sub(__GET_VAR(data__->PDT,), __GET_VAR(data__->CURRENT_TIME,)));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1850
    };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1851
    __SET_VAR(data__->,CDT,,__time_add(__GET_VAR(data__->CURRENT_TIME,), __GET_VAR(data__->OFFSET,)));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1852
  } else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1853
    __SET_VAR(data__->,CDT,,__GET_VAR(data__->CURRENT_TIME,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1854
  };
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1855
  __SET_VAR(data__->,Q,,__GET_VAR(data__->IN,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1856
  __SET_VAR(data__->,PREV_IN,,__GET_VAR(data__->IN,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1857
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1858
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1859
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1860
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1861
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1862
} // RTC_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1863
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1864
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1865
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1866
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1867
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1868
static void SEMA_init__(SEMA *data__, BOOL retain) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1869
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1870
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1871
  __INIT_VAR(data__->CLAIM,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1872
  __INIT_VAR(data__->RELEASE,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1873
  __INIT_VAR(data__->BUSY,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1874
  __INIT_VAR(data__->Q_INTERNAL,__BOOL_LITERAL(FALSE),retain)
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1875
}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1876
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1877
// Code part
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1878
static void SEMA_body__(SEMA *data__) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1879
  // Control execution
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1880
  if (!__GET_VAR(data__->EN)) {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1881
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1882
    return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1883
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1884
  else {
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1885
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1886
  }
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1887
  // Initialise TEMP variables
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1888
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1889
  __SET_VAR(data__->,Q_INTERNAL,,(__GET_VAR(data__->CLAIM,) || (__GET_VAR(data__->Q_INTERNAL,) && !(__GET_VAR(data__->RELEASE,)))));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1890
  __SET_VAR(data__->,BUSY,,__GET_VAR(data__->Q_INTERNAL,));
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1891
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1892
  goto __end;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1893
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1894
__end:
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1895
  return;
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1896
} // SEMA_body__() 
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1897
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1898
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1899
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1900
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1901
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1902
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1903
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1904
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents:
diff changeset
  1905
#endif //_IEC_STD_FB_H