For Programming Embedded Systems Q09 Each state machine is e

For Programming Embedded Systems

Q-09 *Each state machine is entered with the current state and exits with the newly determined state value. Which line is the beginning of the State Machine definitions? Select the example where each state machine has been altered to call and return with its state value

A) Line 50

B) Line 31

C) Line 8

D) Line 62

I. #include \"rims.h\" 2 3 4. typedef struct task state BL LedOff; break; default: int state; unsigned long period; unsigned long elapsedTime: int (*TickFct) (int); taski state ) I Transitions switch (state) case BL Ledoff: 11. task tasks [2] break; case BL Ledon: 13. const unsigned char tasksNum 2; 14. const unsigned long periodBlinkLed = 1500; 15. const unsigned long periodThreeLeds 500; break; default: break; ) // State actions 17, const unsigned long tasksPeriodGCD = 500; return state 19. int TickFct BlinkLed (int state) 20. int TickFct ThreeLeds (int state) 22. unsigned char process!ngRdyTasks = 0; 23. void TimerISR 98. enum TL States TL TO, TL T1, TL T2 TL State; 100 99. int TickFct ThreeLeds (int state) ( 101 VARIABLES MUST BE DECLARED STATIC/ unsigned char i; if (processingRdyTasks) /*e.g., static int x = 0; */ /*variables for state machine go here. printf (\"Period too short \ \"): 103 switch (state) case -1: process!ngRdyTasks = 1; for (1 = 0; 1 = 107 108 109 tasks [i].period) case TL TO: tasks [1]. state = 1 tasks[i].TickFct (tasks[i].state); state = TL T1; tasks[i].elapsedTime0 break; case TL T1: 112 113 tasks [1].elapsedTime += tasksPeriodGCD; processingRdyTasks - 0; state = TL T2 115 116 38. int main) break; case TL T2: unsigned char i=0; tasks [1]. state =-1; tasks [1].period = periodBlinkLed; tasks [1] .elapsedTime tasks [1] ·period; tasks [1].TickFct 6T1ckFct BlinkLed; 118 119 120 121 122 123 1 state = TL T0; break; default: state --1; tasks [1] , state = -1; tasks [1].period periodThreeLeas; tasks [1].elapsedTime = tasks [1].period; tasks [1].TICkFct = &TICkfct; ThreeLeas; 125 switch (state) 127 128 129 130 case TL TO: get Timerset (tasksPeriodGCD); break case TL T1: TimerOn () while (1) Sleep return 0 133 135 137 139 h break case TL T2: 61. enum BL States BL Ledoff, BL Ledon BL State; 62. int TickFct BlinkLed (int state) *VARIABLES MUST BE DECLARED STATIC break; 64. /*e.g., static Int X = 0; */ 65. /*variables for state machine go here/ default: break switch (state) case-1: return state state = BL LedOff break; 146 case BL Ledoff: state = BL Ledon; break; case BL Ledon: 1

Solution

Answer :-

D) Line 62 .

Explanation :

A State represents a significant condition in the life of a Block. State Machines describe how a Block transitions from one State to another and defines what logical behaviour (Activities/Actions owned by the Block) are performed when entering or exiting a State.

For Programming Embedded Systems Q-09 *Each state machine is entered with the current state and exits with the newly determined state value. Which line is the b

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site