External interrupt of cuple or more input port is not pssible.

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

Hi,

 

I use ATxmega64A3U.

I connect two buttons with a ATxmega64A3U of circuit board.

 

The button No1 is PA3,

The button No2 is PC2,

 

 

 

 

I perform sleep of a microcomputer until a button is pushed and make a power save mode.

 


void slave_main(void)
{
	
	volatile fifo_t * fifo;
	u8 length=0;
	int i;
	
	
	SLEEP_CTRL |= SLEEP_SMODE_PSAVE_gc;
	SLEEP_CTRL |= SLEEP_SEN_bm;
	
	PORTA.INT1MASK=0x08;		//GDOA PIN
	//PORTA.INT1MASK=0x04;		//GDOA PIN
	PORTA.INTCTRL=0x0c;
	
	//PORTC.INT0MASK=0x04;		//EMG_Button
	PORTC.INT1MASK=0x04;		//EMG_Button
	//PORTC.INTCTRL=0x03;
	PORTC.INTCTRL=0x08;	
	
	
	while(1)
	{
		
		
		sleep();


		if(interup_state == WAKEUP_DOOR_OPEN)
		{
			for(i=0;i<10;i++)
			{
				set_communication_led(1);
				_delay_ms(1000);
				set_communication_led(0);
				_delay_ms(1000);
			}	
		}
		
		
		if(interup_state == WAKEUP_EMG_SEND)
		{
			for(i=0;i<10;i++)
			{
				set_bat_led(1);
				_delay_ms(1000);		
				set_bat_led(0);
				_delay_ms(1000);					
			}			
		}

	}
}

 

 

The button of PA3 breaks through at an interrupt routine.

However, the button PC2 does not break through at an interrupt routine at all.

 

 


ISR(PORTA_INT1_vect)
{

	test_cnt++;

	
	if(~PORTA.IN & 0x08)
	{
		interup_state = WAKEUP_DOOR_OPEN;
	}
	
	
	if(~PORTC.IN & 0x04)
	{
		interup_state = WAKEUP_EMG_SEND;
	}
}

 

 

I set the INT1 interrupt with both ports.

 

I would like it to tell me why an interrupt of PC2 is not carried out.

 

 

A site of this source code is this place.

https://sourceforge.jp/projects/cc1101atxmega/scm/svn/tree/247/trunk/test_interrupt_02/

 

Thanks

 

 

 

 

 

 

 

 

 

 

This topic has a solution.

kenji maehara

Last Edited: Mon. Feb 9, 2015 - 07:26 AM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
ISR(PORTA_INT1_vect)
{

....	
	
	if(~PORTC.IN & 0x04)

OK I admit I don't know Xmega but it seems very unlikely to me that activity on PORTC would be triggering a PORTA_INT1 interrupt in the first place?

 

Surely if you want to do something similar to PORTA using PORTC you then use something like:

ISR(PORTC_INT1_vect)
{
	test_cnt++;

	if(~PORTC.IN & 0x04)
	{
		interup_state = WAKEUP_EMG_SEND;
	}

?

 

Oh and maybe it happens somewhere else but your slave_main() shows no sign of "sei()" so how do interrupts ever occur anyway?

Last Edited: Mon. Feb 9, 2015 - 12:25 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi clawson,

Thank you for your advice.

 

 

I got a wrong port simply. I made modifications and was settled.


ISR(PORTA_INT1_vect)
{

	test_cnt++;
	//	beep_on_off(1);

	if(~PORTA.IN & 0x08)
	{
		interup_state = WAKEUP_DOOR_OPEN;
	}
	


}


ISR(PORTC_INT1_vect)
{
	
	
	if(~PORTC.IN & 0x04)
	{
		interup_state = WAKEUP_EMG_SEND;
	}	
	
}



 

Thank you for your help.

 

kenji maehara

Last Edited: Sat. Feb 14, 2015 - 05:58 AM