g static int x 0 3 EEL 4730 HW 8Z5 Define user variables for this state machine

G static int x 0 3 eel 4730 hw 8z5 define user

This preview shows page 3 - 6 out of 6 pages.

/*e.g., static int x = 0;*/ 3
Image of page 3

Subscribe to view the full document.

EEL 4730 HW 8Z5 /*Define user variables for this state machine here. No functions; make them global.*/ switch( SM2_State ) { // Transitions case SM2_Init : SM2_State = SM2_T0 ; break; case SM2_T0 : if ( SM2_T0 ) { SM2_State = SM2_T1 ; } break; case SM2_T1 : if ( SM2_T1 ) { SM2_State = SM2_T2 ; } break; case SM2_T2 : if ( SM2_T2 ) { SM2_State = SM2_T0 ; } break; default: SM2_State = SM2_T0 ; } // Transitions switch( SM2_State ) { // State actions case SM2_T0 : B5 = 1 ; B6 = 0 ; B7 = 0 ; break; case SM2_T1 : B5 = 0 ; B6 = 1 ; B7 = 0 ; break; case SM2_T2 : B5 = 0 ; B6 = 0 ; B7 = 1 ; break; default: // ADD default behaviour below break; } // State actions } int main () { B = 0 ; //Init outputs TimerSet ( 500 ); TimerOn (); SM1_State = SM1_Init ; SM2_State = SM2_Init ; while( 1 ) { TickFct_BlinkLED (); TickFct_ThreeLeds (); while (! TimerFlag ); TimerFlag = 0 ; } } 4
Image of page 4
EEL 4730 HW 8Z5 Problem #2: A. Main function initialization of values: lines 101-103 B. Main function idle loop line: 109 C. Main function schedule loop lines: 104-105 5
Image of page 5

Subscribe to view the full document.

EEL 4730 HW 8Z5 Chapter Z8 Outline 1) Different-period tasks can be converted to C via a method that uses new variables for counting timer ticks. a) The timer period can be set to some small value, and then the appropriate number of timer ticks can be counted to determine whether to call a task's tick function on a particular pass through the main code's "while(1)" loop.
Image of page 6
  • 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