GPIO interrupt problem for MC9S08SH8  8 bit microcontroller

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

GPIO interrupt problem for MC9S08SH8  8 bit microcontroller

753 次查看
senthilkumar
Contributor III

Hello,

I am working DEMO9S08SH8 development board  with CW V6.3.

My GPIO interrupt  is not working. my code is ,

void main()

{

    PTBSC_PTBIE = 0; // Disable interrupt

    PTBPS_PTBPS0 = 1; // PortB, bit-0 is enabled for interrupt

    PTBSC_PTBMOD = 0; // edges only

    PTBES_PTBES0 = 0; // interrupt on falling edge

    PTBSC_PTBACK = 1;    // acknowledge flag

    PTBSC_PTBIE = 1; // enable interrupt

 

PTBDD_PTBDD0 = 0;                  

EnableInterrupts;

for(;;)

{

     ;

}

}

interrupt 21 void PORTB_ISR(void)

{

      PTBSC_PTBACK = 1;    // acknowledge flag

}

 

Please any one help me

标签 (1)
0 项奖励
回复
1 回复

599 次查看
egoodii
Senior Contributor III

We will assume you've got Vector 21 (at the active vector table address) pointing to PORTB_ISR.

I would clear PTBDD_PTBDD0 earlier, and set PTBPS_PTBPS0 next-to-last, after all setup steps.

You need to make sure none of the modules defining 'alternate functions' for that pin are turned on, specifically SCI disabled (SCIC2_RE cleared OR SCIC1_LOOPS set) and also ADPCTL1_ADPC4 is cleared.

0 项奖励
回复