Question: Problem: The following HCS12 program generates a square wave on pin PT0: (10 pts) void main(void) { // Set up timer TSCR1 = 0x80; //
Problem: The following HCS12 program generates a square wave on pin PT0: (10 pts)
void main(void) {
// Set up timer
TSCR1 = 0x80; // Enable timer (TEN=1), no fast flag clear (TFFCA=0)
TSCR2 = 0x00; // No interrupts (TOI=0), prescale=000
5.
// Set up output compare on channel 0
TIOS = 0xff; // All Port T is output
TCTL2 = 0x01; // Configure PT0 to toggle
TIE = 0x01; // Enable interrupts on channel 0
TFLG1 = 0x01; // Clear any compare flag (C0F)
___asm CLI;
12.
for(;;) {
_FEED_COP();
}
}
17.
void interrupt (((0x10000-Vtimch7)/2-1) void TC0_ISR (void) {
TFLG1 = 0x01; // Clear compare flag (C0F)
TC0 = TC0 + 6000;
}
(a) Assuming a 24 MHz clock, what is the period of the square wave generated?
(b) Describe the output signal if the programmer used TC0 = TCNT + 6000; on line 20
(c) Describe the output signal if the programmer forgot to enable interrupts (the instruction on
line 9).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
