![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
chad
Dependencies: MCP23017 WattBob_TextLCD mbed-rtos mbed
Diff: main.cpp
- Revision:
- 9:d04a313420c7
- Parent:
- 8:0e46cf19fc45
- Child:
- 10:2414d28be4ba
--- a/main.cpp Tue Mar 07 17:01:38 2017 +0000 +++ b/main.cpp Tue Mar 07 17:31:42 2017 +0000 @@ -24,6 +24,7 @@ // Digital I/O p11 to p20 DigitalIn FqIn(p11); // Digital frequency in for measurement DigitalIn DSIn(p12); // Digital switch input +DigitalIn DS_sIn(p13); // Digital shutdown switch DigitalOut WD_pulse(p14); // Watchdog Pulse SDFileSystem uSD(p5, p6, p7, p8, "uSD"); //uSD pinout @@ -32,9 +33,9 @@ AnalogIn A2_in(p16); // Analogue input to be filtered // Timer objects -Ticker tick; // Clock timer for CycExec +Ticker tick; // Clock timer for CycExec Timer timer; // Frequency Timer -Timer T5; // Timer for idle states +Timer T5; // Timer for idle states // Constant Declaration const int SampFreq = 100; // Sampling Frequency @@ -51,10 +52,9 @@ int A1_val = 0; // Analogue 1 return variable (Analogue In) int A2_val = 0; // Analogue 2 return variable (Analogue In) -int logcount = 0; // Keep track of log number +int error_code = 0; // Error code variable -int T5_ = 0; - +int logcount = 0; // Keep track of log number //////////////////////////////////////////////////////////////////////////////// // @@ -81,8 +81,28 @@ void CycExec() { - if(tck % 40 = 0){ // Every Second (needs offset) - Task1( + if(tck % 40 = 0){ // Every Second (needs offset) + Task1(timer, FqIn, SampFreq, period, freq); + } + else if(tck % 13 = 0){ // Every 1/3 sec + Task2(DSIn, switch_state); + } + else if(tck % 80 = 0){ // Every 2 sec + Task3(WD_pulse, WD); + } + else if(tck % 20 = 0){ // Every 1/2 sec + Task4(A1_val, A2_val, A1_in, A2_in); + } + else if(tck % 80 = 0){ // Every 2 sec + Task5(lcd, freq, switch_state, A1_val, A2_val); + } + else if(tck % 20 = 0){ // Every 1/2 sec + Task7(logcount, fo, freq, switch_state, A1_val, A2_val); + } + else{ + Task8(DS_sIn, ticker, fo, T5); + } +}