![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
chad
Dependencies: MCP23017 WattBob_TextLCD mbed-rtos mbed
Diff: main.cpp
- Revision:
- 10:2414d28be4ba
- Parent:
- 9:d04a313420c7
- Child:
- 11:b48ff77c664a
--- a/main.cpp Tue Mar 07 17:31:42 2017 +0000 +++ b/main.cpp Tue Mar 07 18:00:41 2017 +0000 @@ -22,15 +22,15 @@ FILE *fo; // pointer to uSD object // 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 +DigitalIn Fq(p11); // Digital frequency in for measurement +DigitalIn DS(p12); // Digital switch input +DigitalIn DS_s(p13); // Digital shutdown switch +DigitalOut WD_pulse_out(p14); // Watchdog Pulse SDFileSystem uSD(p5, p6, p7, p8, "uSD"); //uSD pinout // Analogue I/O p15 to p20 -AnalogIn A1_in(p15); // Analogue input to be filtered -AnalogIn A2_in(p16); // Analogue input to be filtered +AnalogIn A1(p15); // Analogue input to be filtered +AnalogIn A2(p16); // Analogue input to be filtered // Timer objects Ticker tick; // Clock timer for CycExec @@ -44,14 +44,22 @@ // Variable Declaration long int tck = 0; // Used to define what task is called (CycExec) +bool FqIn = Fq; // Frequency input boolean int period = 0; // Frequency timer variable (Frequency Check) int freq = 0; // Frequency return variable (Frequency Check) +bool DSIn = DS; // Switch Input boolean bool switch_state = 0; // Switch high or low (Digital In) - + +bool WD_pulse; +bool WD_pulse_out = WD_pulse; + +int A1_In = A1; // Analogue 1 input variable +int A2_In = A2; // Analogue 2 input variable int A1_val = 0; // Analogue 1 return variable (Analogue In) int A2_val = 0; // Analogue 2 return variable (Analogue In) +bool DS_sIn = DS_s // Shutdown Switch boolean int error_code = 0; // Error code variable int logcount = 0; // Keep track of log number @@ -94,14 +102,18 @@ 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); + Task5(freq, switch_state, A1_val, A2_val); + } + else if(tck % 20 = 0){ // Every 0.5 sec + Task6(switch_state, A1_val, A2_val, error_code); } else if(tck % 20 = 0){ // Every 1/2 sec - Task7(logcount, fo, freq, switch_state, A1_val, A2_val); + Task7(logcount, freq, switch_state, A1_val, A2_val); } else{ - Task8(DS_sIn, ticker, fo, T5); + Task8(DS_sIn, ticker, T5); } + tck++; }