enum SM3States SM3QWait SM3OutWait SM3OutChar SM3State TickFctUARTMgr VARIABLES

Enum sm3states sm3qwait sm3outwait sm3outchar

This preview shows page 7 - 9 out of 9 pages.

enum SM3_States { SM3_QWait, SM3_OutWait, SM3_OutChar } SM3_State; TickFct_UARTMgr() { /*VARIABLES MUST BE DECLARED STATIC*/ /*e.g., static int x = 0;*/ /*Define user variables for this state machine here.*/ 7
Image of page 7

Subscribe to view the full document.

HW10Z7 char tmp; switch(SM3_State) { // Transitions case -1: SM3_State = SM3_QWait; break; case SM3_QWait: if (!isempty(&q)) { SM3_State = SM3_OutWait; } break; case SM3_OutWait: if (isempty(&q)) { SM3_State = SM3_QWait; } else if (TxReady) { SM3_State = SM3_OutChar; } break; case SM3_OutChar: if (1) { SM3_State = SM3_OutWait; } break; default: SM3_State = SM3_QWait; } // Transitions switch(SM3_State) { // State actions case SM3_QWait: 8
Image of page 8
HW10Z7 B2=0; break; case SM3_OutWait: B2=0; break; case SM3_OutChar: B2=1; T=removeq(&q); break; default: // ADD default behaviour below break; } // State actions } int main() { B = 0; //Init outputs TimerSet(50); TimerOn(); SM1_State = -1; SM2_State = -1; SM3_State = -1; while(1) { TickFct_ButtonMgr(); TickFct_QueMgr(); TickFct_UARTMgr(); while (!TimerFlag); TimerFlag = 0; } } 9
Image of page 9
  • Fall '13

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes