EmbeddedRelated.com
Forums
Memfault Beyond the Launch

LPC2106 Timer1 problem

Started by ayman ghaly December 3, 2006
Dear all,
I have a problem with a strange behaviour of timer 1 in the keil simulator
(run with the GNU compiler) for a code written for the target LPC2106 evaluation
board.

The problem is that when I tried code (1) shown below in the keil simulator
Timer 1 only reset when it overflows. In the other hand it does resets when I
upload and try the same code with the real board after statements 2, 8, and when
it reaches the matching register after going to sleep.

The contrast happened for code (2) below, i.e. Timer 1 rest in the keil
simulator but doesnt reset in the real board.

I wonder if you have any idea about the cause and/or solution of this problem.
Thanks for your help.
Ayman
Code(1)

T1MCR = 0x00; // don't Interrupt on match MR0, don't rest and don't stop
counter
T1TCR = 0x2; // reset Counter (Timer Counter Register)
T1TCR = 0x01; // Counter enable (Timer Counter Register)
for (i=0;i<100;i++){}//dummy code
T1TCR = 0x00; // stop Counter (Timer Counter Register)
Temp1 = T1TC;
T1MR0 = temp2
T1TCR = 0x2; // reset Counter (Timer Counter Register)
T1MCR = 0x05; // Interrupt on match MR0, and automatically stop counter
T1TCR = 0x01; // Counter enable (Timer Counter Register)
PCON = 1; //go to sleep
Code (2)

T1MCR = 0x00; // don't Interrupt on match MR0, don't rest and don't stop
counter
T1TCR = 0x01; // Counter enable (Timer Counter Register)
for (i=0;i<100;i++){}//dummy code
Temp1 = T1TC;
T1TCR = 0x0; // stop Counter (Timer Counter Register)
T1MR0 =temp2;
T1TCR = 0x3; // reset and enable Counter (Timer Counter Register)
T1MCR = 0x07; // Interrupt on match MR0, and automatically rest and stop
counter
T1TCR = 0x01; // Counter enable (Timer Counter Register)
PCON = 1; //go to sleep

---------------------------------
Check out the all-new Yahoo! Mail beta - Fire up a more powerful email and get things done faster.

An Engineer's Guide to the LPC2100 Series


Memfault Beyond the Launch