why does the Sharc processors timer configured in PWM mode doesn't seem to generate interrupts though all the timer registers seemed to be programmed right?
Though you have the timer registers programmed right, it is also important to follow a proper sequence while programming the timer in PWM mode. When programming the timer the width register must be programmed last, after the timer period register and the timer mode are programmed. Once the width register is programmed the timer can be enabled. Following is an example showing the correct sequence for programming the general purpose timer in PWM mode on SHARC processors.
/* Programming GPTimer in PWM mode */
ustat3 = TIMODEPWM| /* PWM Out Mode */ PRDCNT| /* Count to end of period */ IRQEN;dm(TM0CTL) = ustat3;
R0 = 0x8000;dm(TM0PRD) = R0; /* Timer 0 period = 0x8000 */
/*The width register must be programmed after the period register to enable the timer with the programmed values*/
R1 = 1;dm(TM0W) = R1; /* Timer 0 Pulse width = 1 */
R0 = TIM0EN; /* enable timer 0 */dm(TMSTAT) = R0;
Retrieving data ...