S9S08SG16 ICS TPM error

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

S9S08SG16 ICS TPM error

627 次查看
duffytang
Contributor I

Hello,

        I use the 9S08SG16 and  only configured   ICS  TPM  GPIO to confirm my ICS .   

        But the output is different from what I expected.

        My code is very simple.      

       

        void Init_ICS(void)
           {
              ICSC1 = 0x04; 
             ICSC2 = 0x00; 
           }

         void Init_TPM1(void)
         {
             TPM1SC =0x4c; 
             TPM1CNTH =0; 
         }    

interrupt VectorNumber_Vtpm1ovf void TPM1_OVF_ISR(void)
{
if((TPM1SC & 0x80)==0x80)
{
TPM1SC_TOF = 0; //溢出标志位

IC1_Toogle;

}
}

pastedImage_1.bmp


   

0 项奖励
回复
1 回复

547 次查看
vicentegomez
NXP TechSupport
NXP TechSupport

Hi 

I am not sure if the problem is the way that you are cleaning the flag

I normally use


void interrupt VectorNumber_Vtpm1ovf TPM1ovfISR (void)
{
//Clear interrupt flag
(void)TPM1SC;
TPM1SC_TOF = 0;
PTBD_PTBD6 ^= 1;


}

0 项奖励
回复