GPIO interrupt problem for MC9S08SH8  8 bit microcontroller

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GPIO interrupt problem for MC9S08SH8  8 bit microcontroller

371 Views
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

Labels (1)
0 Kudos
1 Reply

217 Views
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 Kudos