AnsweredAssumed Answered

KL05 Interupt question

Question asked by Dan Bovill on Dec 7, 2014
Latest reply on Jan 10, 2015 by Dan Bovill

Hi All,

I have a FRDM-KL05Z board. I have made a connection between PB10 as an output (Also Blue LED), and PA11 as input, via a 300 Ohm resistor.

My test program reports that the input is following the output but the ISR is not being called. What am I not doing right please?

 

Here are some snippets of code:

 

void PORTA_ISR(void)

{

  PORTA_PCR11 |= PORT_PCR_ISF_MASK;

    printf("\r\n *** ISR *** \r\n");

}

 

int main (void)

{

    #if(defined(CW))

    sysinit();

    #endif

    gpio_init();

    app_init();

    printf("\r\nRunning the project.\r\n");

 

  EnableInterrupts;

 

    LED3_OFF;

    // configure PA11 as input

    PDDR(A) &= ~(1<<11);

    // configure port A for falling edge interupts

    PORTA_PCR11 |= PORT_PCR_IRQC(0x10);

    // Initialise the NVIC to enable the specified IRQ

    enable_irq(30); //30 = 46-16

    // clear PA11 ISF

    PORTA_PCR11 |= PORT_PCR_ISF_MASK;

 

    while(1)

    {

        printf("\r\nInput: %d", PDIR(A) & (1<<11));

        LED3_ON;

        delay(500000);

        printf("\r\nInput: %d", PDIR(A) & (1<<11));

        LED3_OFF;

        delay(500000);

    }

}

 

isr.h:

#ifndef __ISR_H

#define __ISR_H 1

 

#undef  VECTOR_046

#define VECTOR_046      PORTA_ISR

 

extern void PORTA_ISR(void);

 

#endif  //__ISR_H

 

The output of this program is:

 

K05

 

32pin       SRAM Size:  4 KB

 

Silicon rev 15

 

Flash size:  32 KB program flash, 1 KB protection region

 

 

 

Running the project.

 

 

 

Input: 2048

 

Input: 0

 

Input: 2048

 

Input: 0

 

Input: 2048

 

Thanks in advance

Outcomes