targets/Win32/plc_Win32_main.c
changeset 397 6a7ff66a811d
parent 329 22e65b8e20f4
child 446 1edde533db19
--- a/targets/Win32/plc_Win32_main.c	Mon Sep 21 11:56:55 2009 +0200
+++ b/targets/Win32/plc_Win32_main.c	Mon Sep 21 12:00:52 2009 +0200
@@ -8,7 +8,7 @@
 #include <windows.h>
 
 /* provided by POUS.C */
-extern int common_ticktime__;
+extern unsigned long common_ticktime__;
 
 long AtomicCompareExchange(long* atomicvar, long compared, long exchange)
 {
@@ -74,8 +74,8 @@
 int startPLC(int argc,char **argv)
 {
 	unsigned long thread_id = 0;
-	/* Translate PLC's microseconds to Ttick nanoseconds */
-	Ttick = 1000000 * maxval(common_ticktime__,1);
+	/* Define Ttick to 1ms if common_ticktime not defined */
+    Ttick = common_ticktime__?common_ticktime__:1000000;
 
 	debug_sem = CreateSemaphore(
 							NULL,           // default security attributes
@@ -142,7 +142,7 @@
     }
     return 0;
 }
-static int __debug_tick;
+static unsigned long __debug_tick;
 
 int TryEnterDebugSection(void)
 {
@@ -170,7 +170,7 @@
 }
 
 /* from plc_debugger.c */
-int WaitDebugData()
+unsigned long WaitDebugData()
 {
 	if(WaitForSingleObject(debug_wait_sem, INFINITE) != WAIT_OBJECT_0) return -1;
 	return __debug_tick;