Interrupt problem Xmega128a1

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

i'm trying to work with external interrupt on PORTE pin 0, however it doesn't work at all.

This is what i programmed for this portE:
(using codevisionAVR)
1)global interrupt enable ON:
#asm("sei")
2)PORTE as input:
PORTE.DIR=0x00;
// Bit0 Output/Pull configuration: Totempole/No
// Bit0 Input/Sense configuration: Sense both edges
// Bit0 inverted: Off
// Bit0 slew rate limitation: Off
3)PINE control:
PORTE.PIN0CTRL=PORT_OPC_TOTEM_gc | PORT_ISC_BOTHEDGES_gc;
// Bit1 Output/Pull configuration: Totempole/No
// Bit1 Input/Sense configuration: Sense both edges
// Bit1 inverted: Off
// Bit1 slew rate limitation: Off
4)interrupt control function:interrupt on pin0 for PORTE:
PORTE.INTCTRL=0x01;

5)my interrupt routine (less important)
// PORTE interrupt 0 service routine
interrupt [PORTE_INT0_vect] void porte_int0_isr(void)
{

PORTK.OUT=0b11101110;
delay_ms(10);

}

Remark: port K is well programmed, cause in the main program I set portK to 00110011 and correponding LEDS are on!

Now, I connect a pulse generator with 1Hz to PE0 and nothing happens.

Did I forget or misprogram my interrupt for this pin PE0??

Can't find it.
Please help,

thank you for any suggestions,

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't see any code to configure the PMIC to enable particular interrupt levels. With the XMega, sei is not enough- ya gotta twiddle the PMIC. :idea:

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You are completely right! now it works, great! I had to program PMIC.CTRL register with the right value, that's all to make it work.
I appreciate your help, it saves me a lot of time!