francisco francisco

PWM module and Timer module

Discussion created by francisco francisco on Aug 15, 2011
Latest reply on Aug 19, 2011 by francisco francisco

Hi,

I am using a MC9S1264MFA microcontroler. I was trying use PWM2 channel and the timer 2 interrupt, can I use two function at same time?

I do this question because, PWM channel 2 working normally but timer 2 don´t work like I configured .

PWM channel 2 configuration:

    MODRR = 0x14;  
    PWME = 0;      
    PWMPOL = 0x14;  
    PWMCLK = 0x14; 
    PWMPRCLK = 0x00;
    PWMSCLA = 0x0C; 
    PWMSCLB = 0x0C;
    PWMCAE = 0x00;  

    PWMPER and PWMDTY was dynamically configured.

Timer 2 configuration:

    TSCR2     =     0x84; 
    TSCR1    =     0x80;  
    TIOS     |=     0x04;
    TIE        |=     0x04;        
    TC2        =    0x01; 
    TCTL2    &=    0xCF;
    TCTL4    &=    0xCF;
    TFLG1    |=    0x04;

I´m trying configure to 0,666us, but the interrupt occur every 0,042ms.
what I´m doing wrong?

Outcomes