--- a/targets/plc_common_main.c Mon Sep 21 11:56:55 2009 +0200
+++ b/targets/plc_common_main.c Mon Sep 21 12:00:52 2009 +0200
@@ -5,13 +5,13 @@
#include <locale.h>
#include "iec_types.h"
/*
- * Prototypes of functions provied by generated C softPLC
+ * Prototypes of functions provided by generated C softPLC
**/
-void config_run__(int tick);
+void config_run__(unsigned long tick);
void config_init__(void);
/*
- * Prototypes of functions provied by generated target C code
+ * Prototypes of functions provided by generated target C code
* */
void __init_debug(void);
void __cleanup_debug(void);
@@ -22,8 +22,13 @@
* Variables used by generated C softPLC and plugins
**/
IEC_TIME __CURRENT_TIME;
-IEC_BOOL __DEBUG;
-int __tick = -1;
+IEC_BOOL __DEBUG = 0;
+unsigned long __tick = -1;
+
+/*
+ * Variable generated by C softPLC and plugins
+ **/
+extern unsigned long greatest_tick_count__;
/* Help to quit cleanly when init fail at a certain level */
static int init_level = 0;
@@ -39,6 +44,8 @@
void __run()
{
__tick++;
+ if (greatest_tick_count__)
+ __tick %%= greatest_tick_count__;
%(retrieve_calls)s
@@ -53,7 +60,7 @@
}
/*
- * Initialize variables according to PLC's defalut values,
+ * Initialize variables according to PLC's default values,
* and then init plugins with that values
**/
int __init(int argc,char **argv)
@@ -85,7 +92,7 @@
static long long Tsync = 0;
static long long FreqCorr = 0;
static int Nticks = 0;
-static int last_tick = 0;
+static unsigned long last_tick = 0;
static long long Ttick = 0;
#define mod %%
/*