Bug with non-working counters fixed
authorlbessard
Tue, 19 May 2009 16:31:35 +0200
changeset 176 bef3cc16c064
parent 175 dadda1b5401e
child 177 697562a5da7c
Bug with non-working counters fixed
lib/counter.txt
--- a/lib/counter.txt	Mon May 18 13:19:30 2009 +0200
+++ b/lib/counter.txt	Tue May 19 16:31:35 2009 +0200
@@ -28,11 +28,8 @@
     Q : BOOL;
     CV : INT;
   END_VAR
-  VAR RETAIN
-    PVmax : INT;
-  END_VAR
   IF R THEN CV := 0 ;
-  ELSIF CU AND (CV < PVmax)
+  ELSIF CU AND (CV < PV)
        THEN CV := CV+1;
   END_IF ;
   Q := (CV >= PV) ;
@@ -49,11 +46,8 @@
     Q : BOOL;
     CV : INT;
   END_VAR
-  VAR RETAIN
-    PVmin : INT;
-  END_VAR
   IF LD THEN CV := PV ;
-  ELSIF CD AND (CV > PVmin)
+  ELSIF CD AND (CV > 0)
       THEN CV := CV-1;
   END_IF ;
   Q := (CV <= 0) ;
@@ -73,17 +67,13 @@
     QD : BOOL;
     CV : INT;
   END_VAR
-  VAR RETAIN
-    PVmax : INT;
-    PVmin : INT;
-  END_VAR
   IF R THEN CV := 0 ;
   ELSIF LD THEN CV := PV ;
   ELSE
     IF NOT (CU AND CD) THEN
-      IF CU AND (CV < PVmax)
+      IF CU AND (CV < PV)
       THEN CV := CV+1;
-      ELSIF CD AND (CV > PVmin)
+      ELSIF CD AND (CV > 0)
       THEN CV := CV-1;
       END_IF;
     END_IF;