targets/plc_common_main.c
changeset 236 a32817e81f5e
parent 235 a66e150f2888
child 239 112b4bc523b3
equal deleted inserted replaced
235:a66e150f2888 236:a32817e81f5e
    31 /*
    31 /*
    32  *  Functions and variables to export to generated C softPLC and plugins
    32  *  Functions and variables to export to generated C softPLC and plugins
    33  **/
    33  **/
    34  
    34  
    35 IEC_TIME __CURRENT_TIME;
    35 IEC_TIME __CURRENT_TIME;
    36 int __tick = 0;
    36 int __tick = -1;
    37 
    37 
    38 static int init_level = 0;
    38 static int init_level = 0;
    39 static int Debugging = 0;
    39 static int Debugging = 0;
    40 static int WasDebugging = 0;
    40 static int WasDebugging = 0;
    41 void AbortDebug();
    41 void AbortDebug();
    48 /*
    48 /*
    49  * Retrieve input variables, run PLC and publish output variables 
    49  * Retrieve input variables, run PLC and publish output variables 
    50  **/
    50  **/
    51 void __run()
    51 void __run()
    52 {
    52 {
       
    53     __tick++;
       
    54 
    53     %(retrieve_calls)s
    55     %(retrieve_calls)s
    54 
    56 
    55     if(Debugging) __retrieve_debug();
    57     if(Debugging) __retrieve_debug();
    56     
    58     
    57     config_run__(__tick);
    59     config_run__(__tick);
    60     else if(WasDebugging) AbortDebug();
    62     else if(WasDebugging) AbortDebug();
    61     WasDebugging = Debugging;
    63     WasDebugging = Debugging;
    62     
    64     
    63     %(publish_calls)s
    65     %(publish_calls)s
    64 
    66 
    65     __tick++;
       
    66 }
    67 }
    67 
    68 
    68 /*
    69 /*
    69  * Initialize variables according to PLC's defalut values,
    70  * Initialize variables according to PLC's defalut values,
    70  * and then init plugins with that values  
    71  * and then init plugins with that values