Hi,
We are experiencing some issues with external interrupts resetting an Analog Devices ADuC842 controller (8051 family). The system we are working on analyses sensorial data from a rotary encoder connected to EX0. The interrupt is configured to be level-triggering. In our current set-up, the controller spontaneously resets when the rate with which the sensor interrupts occur exceeds certain level. We know from counting the number of CPU instructions in our ISR and estimating the number of interrupts, that the problem is likely to stem from the controller not being able to process the interrupts quick enough. What we fail to understand, though, is why this would reset the controller as we would expect the interrupt system to either queue interrupts occurring too soon to be processed, or to ignore them altogether.
Can someone help us understand what is / might be going on?
To set up the interrupt we've got the following code:
IT0 = 0; /* Configure interrupt to be level triggering. */ EX0 = 1; /* Enable external interrupt 0. */ EA = 1; /* Global interrupt enable. */
Our ISR:
static void encoder_isr(void) interrupt 0 { unsigned int new_AB; unsigned int old_and_new;
/* Get the new A and B values by masking the entire port byte to avoid interference from pending interrupts: */ new_AB = (P1 & 0x18) >> 3;
/* Combine the old and new A and B values. The resulting bit pattern indicates the direction of movement. eg: old = 0000 0011 ---------