• AVR Freaks

Hot!AVR interrupt issues

Author
jgalanti
New Member
  • Total Posts : 2
  • Reward points : 0
  • Joined: 2015/08/04 19:03:25
  • Location: 0
  • Status: offline
2020/12/21 09:31:40 (permalink)
0

AVR interrupt issues

I'm working with the ATxmega64A3U and having problems getting a second pin change interrupt to work correctly. I  intially had one ISR for one pin which worked fine, but when adding the second pin and ISR handler it does not reach the handler.
Below is the code initializing both vectors
#define INTERLOCK_INT_vect        PORTE_INT0_vect
#define INTERLOCK2_INT_vect      PORTE_INT1_vect
 
then  (the first one works)
INTERLOCK_PORT.DIRCLR = INTERLOCK_PIN;
INTERLOCK_PORT.INTERLOCK_PINCTRL = (PORT_OPC_PULLUP_gc | PORT_ISC_FALLING_gc);
//INTERLOCK_PORT.INTCTRL = (PORT_INT0LVL_MED_gc);

INTERLOCK2_PORT.DIRCLR = INTERLOCK2_PIN;
INTERLOCK2_PORT.INTERLOCK2_PINCTRL = (PORT_OPC_PULLUP_gc | PORT_ISC_FALLING_gc);
INTERLOCK2_PORT.INTCTRL = (PORT_INT0LVL_MED_gc | PORT_INT1LVL_LO_gc); 
 
and then the two handler (just the beginning)
ISR(INTERLOCK_INT_vect)
{
uint8_t vpa_result = 0;
uint8_t intlk_signal_state = 0;
if(1)
{
#if PWM_DURING_INTER
SET_STATE(STATE_PROCESS);
pwm_stop();
#endif
start_intlk_timer = 1;
LeftLedRedOn();
:
:
:
}
 and 
ISR(INTERLOCK2_INT_vect)
{
uint8_t vpa_result = 0;
//uint8_t intlk_signal_state = 0;
if(1)
{
#if PWM_DURING_INTER
SET_STATE(STATE_PROCESS);
pwm_stop();
#endif
start_intlk_timer = 1;
RightLedRedOn();

Right_LED_Flag = 1;
:
:
:
 
}
 
The pin macros are 
#define INTERLOCK_PORT PORTE
#define INTERLOCK_PIN PIN2_bm
#define INTERLOCK_PINCTRL PIN2CTRL
#define INTERLOCK2_PORT PORTE
#define INTERLOCK2_PIN PIN1_bm
#define INTERLOCK2_PINCTRL PIN1CTRL
 
via the debugger, both interrupt levels are being set but the second one does not work.....
 
#1

0 Replies Related Threads

    Jump to:
    © 2021 APG vNext Commercial Version 4.5