ECE 3724/CS 3124 Quiz #9 – Timers Quiz, Fall 04 Solution - Reese a. Assuming a oscillator frequency of 12 MHz, configure Timer 2 and the PWM module to produce a square wave with frequency of 3 KHz (just give prescale, PR2 values – I do not want C-code). Choose the prescaler such that the PR2 value is greater than 10. b. c. Assuming TIMER2 is configured for PWM mode, with a value of 0xC8 for the PR2 value. What value for the upper 8 bits would need to be written to the duty cycle register (CCPR1L) to give a duty cycle of 20%? d. Assume Timer2 is configured to produce an interrupt period of X for postscale = 4, prescale =4, and PR2 = 0xC0. If PR2 is changed to 0x20, postscale changed to 15, and prescale changed to 1, how does the new interrupt period Y relate to the old interrupt period of X? e. Write C code that configures timer1 for a prescale of 8, internal clock, 16-bit read/write mode, turns it on, enables its interrupts, and enables capture mode for every falling edge. f.
This is the end of the preview. Sign up
access the rest of the document.
This note was uploaded on 03/21/2012 for the course ECE 3724 taught by Professor Bloom during the Spring '12 term at University of Florida.