I'm trying to setup 2 Pin Change interrupts on the Duemilanove. I seem to have one setup on Pin 8 ok but the one for Pin 7 doesn't work. As a matter of fact when drive Pin 7 high it usually causes the controller to reset. Any help with setting up the control registers would be appreciated. Here's what I have. Thanks.
/* Use remaining pin change interrupts for lanes 3 and 4. These must be configured
a different way. */
PCICR = mask_clear_all; // Clear out the PC Int. Control Registerhhh
PCICR |= mask_bit0; // Enable PCIE0 for Lane 3 (pin 8)
PCICR |= mask_bit2; // Enable PCIE2 for Lane 4 (pin 7)
PCMSK0 |= mask_bit0; // Enable interrupt for Digital Pin #8
PCMSK2 |= mask_bit7; // Enable interrupt for Digital Pin #7
/*
* Here are my ISRs for the Pin change Interrupts
*/
/*
* Interrupt Service Routine for lane 3
*/
ISR( PCINT0_vect )
{
//if( HIGH == digitalRead(lane3Pin) )
ts_lanes[LANE3].timestamp = millis();
if( ts_lanes[LANE3].timestamp > ts_lanes[LANE3].debouncets )
{
ts_lanes[LANE3].active = true;
ts_lanes[LANE3].debouncets = ts_lanes[LANE3].timestamp + 500; //500ms debounce
}
}
/*
* Interrupt Service Routine for lane 4
*/
ISR( PCINT23_vect )
{
//if( HIGH == digitalRead(lane4Pin) )
ts_lanes[LANE4].timestamp = millis();
if( ts_lanes[LANE4].timestamp > ts_lanes[LANE4].debouncets )
{
ts_lanes[LANE4].active = true;
ts_lanes[LANE4].debouncets = ts_lanes[LANE4].timestamp + 500; //500ms debounce
}
}