2106 and 2138 interrupt and IOPIN
2006-02-04 by charlesgrenz
Hello group,
Have a strange problem. The following code works perfectly on a LPC2106.
if (((T1IR & T1IR_MR2INT) != 0) || (T1MR2 < T1TC)) // Timer 1,
Match 2 - 500ms LED Delay <<<<<<<<<<<<<<<<<<<<<<
{
T1MR2 = T1TC + DEFAULT_TMR1_MR2_TIMEBASE; // Count up to this
value. Generate 2 Hz interrupt.
if ((IOPIN & POWER_LED) == 0)
{
IOSET = POWER_LED;
}
else
{
IOCLR = POWER_LED;
}
}
=================================================
I then used the same software on a LPC2138 and it only runs once and
then never again.
if (((T1IR & T1IR_MR2INT) != 0) || (T1MR2 < T1TC)) // Timer 1,
Match 2 - 500ms LED Delay <<<<<<<<<<<<<<<<<<<<<<
{
T1MR2 = T1TC + DEFAULT_TMR1_MR2_TIMEBASE; // Count up to this
value. Generate 2 Hz interrupt.
if ((IO0PIN & POWER_LED) == 0)
{
IO0SET = POWER_LED;
}
else
{
IO0CLR = POWER_LED;
}
}
========================================================
I then changed the routine to the following and found it worked
perfectly on the LPC2138.
if (((T1IR & T1IR_MR2INT) != 0) || (T1MR2 < T1TC)) // Timer 1,
Match 2 - 500ms LED Delay <<<<<<<<<<<<<<<<<<<<<<
{
T1MR2 = T1TC + DEFAULT_TMR1_MR2_TIMEBASE; // Count up to this
value. Generate 2 Hz interrupt.
if (led_50 == TRUE)
{
IO0SET = POWER_LED;
led_50 = FALSE;
}
else
{
IO0CLR = POWER_LED;
led_50 = TRUE;
}
}
It almost looks like that the IO0PIN can not be read in an interrupt
for the 2183 but it is ok on the 2106. Anyone else seen this behavior
before??
PS I checked the assembly code and all looked perfect!
regards,
Charles