AnsweredAssumed Answered

MCF51AC256A TPM3 interrupt problem

Question asked by Mladen Koren on Jan 21, 2016
Latest reply on Jan 25, 2016 by Mladen Koren

Hello,

I'm trying to setup TPM3CH0 timer to get every 150ms interrupt to execute one function, using CodeWarrior Development Studio for Microcontrollers V6.3. I did not use Processor Expert or Device Initialization because I'm changing old code and adding some new stuffs. On PTB0 (TPM3CH0) is connected LED.

 

Below is c/p part of code responsible for TPM3

 

 

   

   void main (void)

     { 

          /*cut*/      

            //TPM3MOD=19660 ;  //150ms

            TPM3MOD=58980;          //450ms to see if led blink

            TPM3SC_PS=5 ;    //PS=5 -> =Tclock*32

            TPM3SC_CLKSx=1;  // Clock is bus clock(=fosc/2)

            TPM3C0SC_MS0x=1;  //mode out

            TPM3C0SC_ELS0x=1; //toggle output

 

            TPM3SC_TOIE=1;

            EnableInterrupts; /* enable interrupts */

 

           /*cut*/

 

     }

 

void interrupt VectorNumber_Vtpm3ch0 tpm3ch0_isr(void) {

  TPM3C0SC_CH0F=0;

  //TPM3C0V=19660;

  TPM3C0V=58980;     //450ms to see if led blinking

   FunctionCall();          //call my function

}

 

But when first time TPM3C0V reach value of 19660, it True-Time Simulator & Real-Time Debugger, in Command window I got "ILLEGAL_BP". I try put breakpoint at first line in interrupt but program never reach that part.

 

Can someone, please, help me to debug code (I'm new in CW & MCF51).

 

Thanks and regards,

Mladen

Outcomes