Answered You can hire a professional tutor to get the answer.

QUESTION

14.6 A- Fill in the Blanks for the required C instructions, and also fill in the missing comments

14.6 A- Fill in the Blanks for the required C instructions, and also fill in the missing comments

/*******************************************************************

This program outputs 30 kHz square wave on

port T, bit-0 using timer channel 0 interrupts and the

output compare bit operations.

*******************************************************************/

#include <mc9s12c32.h> /* derivative information */

#define HALF_P 133 /* Number clocks per 1/2 period */

/******************************************************************/ void interrupt 8 OC0_isr (void);

/******************************************************************/ void main(void) {

   /******************************************************************/

      /* Initialize I/O */

     ___________________ = 1; /* Enable the timer */

                              /*which Register, Which Flag bit */

     TIOS_IOS0 = _________;   /* Enable output compare channel 0 */

      /* Set up TC0 */

     _________________ = TCNT;

      /* Now have ~ 8 ms to set up the system without an interrupt */

     TFLG1 = TFLG1_C0F_MASK;/* Clear C0F flag */

     __________________ = 1; /* Enable the interrupt */

    /* Set up the output compare action to toggle

     * port T, bit-0. (DDRT does not need to be set.)

     */

     TCTL2_OM0 = 0;

     TCTL2_OL0 = 1;

     EnableInterrupts; /* Unmask interrupts */

      /* DO */

      for(;;) {

     }

      /* FOREVER */

}

/******************************************************************* * The interrupt service routine simply sets up the TC0

* for the next interrupt time.

*******************************************************************/ void interrupt 8 OC0_isr ( void ){

   /******************************************************************/

      /* Set up TC0, How? Need to add what Register? */

     TC0 += _______________________;

  TFLG1 = TFLG1_C0F_MASK; /* ______________________________________ */

}

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question