Embedded software Assessment 2

Dependencies:   MCP23017 SDFileSystem USBDevice WattBob_TextLCD mbed

Revision:
18:f485d46a7acb
Parent:
17:dba09fb3f508
Child:
19:304b17087d06
diff -r dba09fb3f508 -r f485d46a7acb main.cpp
--- a/main.cpp	Fri Feb 28 10:29:29 2014 +0000
+++ b/main.cpp	Tue Mar 04 17:03:38 2014 +0000
@@ -1,4 +1,4 @@
-/*
+/*                                        Cyclic Executive
 This software is built to test (Cyclic Executive). Five main functions are used in and every one of them
 has its own time of repetition. To execute this, a Ticker was used to call a function every 100 mSec.
 In other words, when 100 mSec is passed, the Cycle function is called and so on every 100 mSec. In this
@@ -7,7 +7,7 @@
 result every 4 cycle (400 mSec) the condition be true and calling the function. Also, after 8 cycles (800 mSec)
 the condition is true for two factions, but the processor will implement on the priority that it was put in 
 the program.
-
+http://mbed.org/users/muaiyd/code/ass2/
 */
 #include "Function.h"
 
@@ -23,10 +23,14 @@
 }
 
 void CycleFunction(){
-    TickerPin=!(TickerPin);
-    Counter++;
+    TickerPin = !(TickerPin);
     //Can see the period of execute every function below on the pin that
     //writen infront of it
+    //The least common multiple for all the above is 1800 cycles
+    // so every 180 Sec all the functions are repeated
+    Counter++;
+    if(Counter == 1800) Counter = 0;
+    
     if((float(Counter/4.0)-Counter/4)==0) ReadDigitalin();  //Pin 21
     if((float(Counter/8.0)-Counter/8)==0) ReadAnalogin();   //Pin 22
     if((float(Counter/10.0)-Counter/10)==0) FreqMsur();     //Pin 23
@@ -34,7 +38,5 @@
     if((float(Counter/18.0)-Counter/18)==0) InputCheck();   //Pin 25
     if((float(Counter/20.0)-Counter/20)==0) Display();      //Pin 26
     if((float(Counter/50.0)-Counter/50)==0) LogFile();      //Pin 27
-    //The least common multiple for all the above is 1800 cycles
-    // so every 180 Sec all the functions are repeated
-    if(Counter==1800) Counter=0;  
+  
 }
\ No newline at end of file