XMega 128B1 External interrupt problem

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

Good day all!

I have to say that the XMegas has been giving me headaches from get go. Sheees, I keep on banging my head over and over. :evil: Anyway, I'm very close to get everything working that I need to finish my project.

I'm trying to get the external interrupts working. Here are some snippets:

#include 
#include 

PORTC.DIR=0x0C;

volatile int Temp = 0;
//Setup external interrupt
// external interrupt 0 external interrupt on , sense Bothedges edge
	PORTC.PIN5CTRL = PORT_ISC_BOTHEDGES_gc;	//Enable no pullups, and set interrupt on both edge
	PORTC.INT0MASK = PIN5_bm;				//Define pin number and interrupt number
	PORTC.INTCTRL = PORT_INT0LVL_HI_gc;		//set priority level to high
	PORTC.INTFLAGS = 1;

PMIC.CTRL |= PMIC_LOLVLEN_bm | PMIC_MEDLVLEN_bm | PMIC_HILVLEN_bm;	//Enable all level interrupts

//Enable global interrupts
sei();

ISR(PORTC_INT0_vect)
{
	Temp = Temp + 1;
	PORTC.INTFLAGS = 1;
}

In the main loop I have a function to display the the Value of Temp on a LCD display and it just says "0" the whole time. I'm very sure that the interrupt never fires. I did try using the hardware in the loop without interrupts and it worked fine. Here is the story, I read the data sheet cover to cover and read many a post, but with no success. I'm starting to wonder if there is something that I have overlooked. Something like a flag or some peripheral that I'm not enabling.

Any pointers/suggestions?

-=!F34R!=-

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

Hey Dear,

Did you get any working solution yet? If yes, could you please suggest me possibly wrong thing in my case which is same as yours. I am facing the same problem.

 

Thanks

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

Posting a question on a 3.5 year old post is not a very good way to get an answer.

 

Posting the code that you are trying to get working as a new topic is a much better way.

 

 

EDIT: was off by a year...

Greg Muth

Portland, OR, US

Xplained Boards mostly

Atmel Studio 7.0 on Windows 10

 

Last Edited: Wed. Oct 4, 2017 - 04:27 PM