targets/Win32/plc_Win32_main.c
changeset 685 2db8b87016a0
parent 681 383864958dac
child 709 fe65601bd983
--- a/targets/Win32/plc_Win32_main.c	Wed Feb 15 00:44:24 2012 +0100
+++ b/targets/Win32/plc_Win32_main.c	Wed Feb 15 16:39:56 2012 +0100
@@ -38,7 +38,7 @@
 	/* arg 2 of SetWaitableTimer take 100 ns interval*/
 	liDueTime.QuadPart =  next / (-100);
 
-	if (!SetWaitableTimer(PLC_timer, &liDueTime, period/1000000, NULL, NULL, 0))
+	if (!SetWaitableTimer(PLC_timer, &liDueTime, period<1000000?1:period/1000000, NULL, NULL, 0))
     {
         printf("SetWaitableTimer failed (%d)\n", GetLastError());
     }
@@ -116,6 +116,7 @@
 
 
     /* Create a waitable timer */
+    timeBeginPeriod(1);
     PLC_timer = CreateWaitableTimer(NULL, FALSE, "WaitableTimer");
     if(NULL == PLC_timer)
     {