static char mystrNow is the time for all good men to come to the aid of their

Static char mystrnow is the time for all good men to

This preview shows page 4 - 8 out of 9 pages.

static char * mystr="Now is the time for all good men to come to the aid of their country\n"; switch(SM1_State) { // Transitions case -1: SM1_State = SM1_init; break; case SM1_Wait: if (A0) { SM1_State = SM1_OutStr; pstr=mystr; 4
Image of page 4

Subscribe to view the full document.

HW10Z7 } break; case SM1_OutStr: if (!A0) { SM1_State = SM1_Wait; } break; case SM1_init: if (1) { SM1_State = SM1_Wait; } break; default: SM1_State = SM1_init; } // Transitions switch(SM1_State) { // State actions case SM1_Wait: pstr=NULL; B0=0; break; case SM1_OutStr: B0=1; break; case SM1_init: q.rear=q.front=0; UARTOn(); // activate UART printf("Str len:%d\n",strlen(mystr)); 5
Image of page 5
HW10Z7 break; default: // ADD default behaviour below break; } // State actions } enum SM2_States { SM2_WaitPstr, SM2_QMgr } SM2_State; TickFct_QueMgr() { /* LOAD THE QUEUE */ /*VARIABLES MUST BE DECLARED STATIC*/ /*e.g., static int x = 0;*/ /*Define user variables for this state machine here.*/ switch(SM2_State) { // Transitions case -1: SM2_State = SM2_WaitPstr; break; case SM2_WaitPstr: if (pstr!=NULL) { SM2_State = SM2_QMgr; } break; case SM2_QMgr: if (1) { SM2_State = SM2_WaitPstr; } break; default: 6
Image of page 6

Subscribe to view the full document.

HW10Z7 SM2_State = SM2_WaitPstr; } // Transitions switch(SM2_State) { // State actions case SM2_WaitPstr: B1=0; break; case SM2_QMgr: // LOAD STRING ONTO QUEUE B1=1; //printf("%s",pstr); // or while(*pstr!=EOS){ insertq(&q,*pstr++); } pstr=NULL; break; default: // ADD default behaviour below break; } // State actions }
Image of page 7
Image of page 8
  • 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