Question: Finish the code#include RIMS.h / / Required . h file that defines RIM - specific properties volatile int TimerFlag = 0 ; void TimerISR

Finish the code#include "RIMS.h"// Required .h file that defines RIM-specific properties
volatile int TimerFlag =0;
void TimerISR(){
TimerFlag =1;
}
enum SM2_STATES { SM2_SMStart, SM2_s0, SM2_s1, SM2_s2} SM2_STATE;
void Tick_HiLo2(){
switch(SM2_STATE){
case SM2_SMStart:
if (1){
SM2_STATE = SM2_s0;
}
break;
case SM2_s0:
if (A2 && !A6){
SM2_STATE = SM2_s1;
}
else if (!A2 && A6){
SM2_STATE = SM2_s2;
}
else if ((!A2 && !A6)||(A2 && A6)){
SM2_STATE = SM2_s0;
}
else {
SM2_STATE = SM2_s0;
}
break;
case SM2_s1:
if (!(A2 && !A6)){
SM2_STATE = SM2_s0;
}
else if (A2 && !A6){
SM2_STATE = SM2_s1;
}
else {
SM2_STATE = SM2_s1;
}
break;
case SM2_s2:
if (!(!A2 && A6)){
SM2_STATE = SM2_s0;
}
else if (!A2 && A6){
SM2_STATE = SM2_s2;
}
else {
SM2_STATE = SM2_s2;
}
break;
default:
SM2_STATE = SM2_s0;
break;
}
}
int main(){
int HiLo2ElapsedTime =500;
int periodGCD =500;
TimerSet(periodGCD);
TimerOn();
while(1){
if (HiLo2ElapsedTime >=500){
Tick_HiLo2();
HiLo2ElapsedTime =0;
}
HiLo2ElapsedTime +=500;
while(!TimerFlag);
TimerFlag=0;
}
return 0;
} to implement the state machine.
Finish the code#include "RIMS.h " / / Required .

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!