![](/media/cache/profiles/8138ec4f8dbf9991f277b91dd462de7d.jpg.50x50_q85.png)
Example software for a Cyclic Executive
Dependencies: MCP23017 SDFileSystem WattBob_TextLCD mbed
Diff: main.cpp
- Revision:
- 9:46408a8dea0c
- Parent:
- 8:7f3594882cec
- Child:
- 10:c0531edf4850
--- a/main.cpp Wed Mar 02 01:03:09 2016 +0000 +++ b/main.cpp Wed Mar 02 09:38:47 2016 +0000 @@ -109,8 +109,6 @@ } } -Timer stampTime; - #define TASK1_TICKS 40 #define TASK2_TICKS 12 #define TASK3_TICKS 12 @@ -121,96 +119,7 @@ #define HIGH 1 -//void CyclicExec() -//{ -// slotCounter++; -// switch(slotCounter) -// { -// case 1: -// if(cyclicTicks % TASK1_TICKS == 0) -// { -//// printf("T1\r\n"); -// task1Frequency = task1.ReadFrequency(); -// } -// break; -// -// case 2: -// if(cyclicTicks % TASK2_TICKS == 0) -// { -//// printf("T2\r\n"); -// task2SwitchState = task2_switch1.digitalInState(); -// } -// break; -// -// case 3: -// if(cyclicTicks % TASK3_TICKS == 0) -// { -//// printf("T3 ------ \r\n"); -// LenPin = 1; -// task3.OutputWatchdogPulse(); -// LenPin = 0; -// } -// break; -// -// case 4: -// if(cyclicTicks % TASK4_TICKS == 0) -// { -//// printf("T4\r\n"); -// float *analogReading = task4.returnAnalogReadings(); -// task4AnalogChannels[0] = *(analogReading); -// task4AnalogChannels[1]= *(analogReading+1); -// } -// break; -// -// case 5: -// if(cyclicTicks % TASK5_TICKS == 0) -// { -//// printf("T5\r\n"); -// task5.updateDisplay( task1Frequency, -// task2SwitchState, -// task6ErrorState, -// task4AnalogChannels[0], -// task4AnalogChannels[1] ); -// } -// break; -// -// case 10: -// if(cyclicTicks % TASK6_TICKS == 0) -// { -//// printf("T6\r\n"); -// task6ErrorState = task6.updateErrorCode( task2SwitchState, -// task4AnalogChannels[0], -// task4AnalogChannels[1] ); -// } -// break; -// -// case 11: -// if(cyclicTicks % TASK7_TICKS == 0) -// { -//// printf("T7\r\n"); -// int a = sprintf( logData,"Freq=%d,SW1=%d,A1=%1.3f,A2=%1.3f\n", -// task1Frequency, -// task2SwitchState, -// task4AnalogChannels[0], -// task4AnalogChannels[1] ); -// task7.writeData(logData); -// } -// break; -// -// case 12: -// slotCounter = 0; -// cyclicTicks++; -// break; -// } -// if(SDRemoval == HIGH) -// { -// printf("Shutting File"); -// task7.closeFile(); -// } -// -// -//} - +Timer stampTime; Timer task1t; Timer task2t; Timer task3t; @@ -284,7 +193,6 @@ { if(taskNum == 2) { -// printf("IM IN TASK 2!!!!!!!!!!!!!!!!!!!!!\r\n"); task2t.stop(); printf("T2 %d\r\n",task2t.read_ms()); task2SwitchState = task2_switch1.digitalInState(); @@ -294,7 +202,6 @@ } else if(taskNum == 3) { -// printf("IM IN TASK 3!!!!!!!!!!!!!!!!!!!!!\r\n"); task3t.stop(); printf("T3 %d\r\n",task3t.read_ms()); task3.OutputWatchdogPulse(); @@ -308,6 +215,7 @@ { printf("SD Removed"); task7.closeFile(); + CyclicTicker.detatch(); } }