v.s.n.kumar
Member level 1
- Joined
- Dec 2, 2013
- Messages
- 38
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 6
- Activity points
- 303
Hi,
please can anybody help me to solve the below problem. i have been facing this problem since 3days. i.e., cclk=12mhz, pclk=3mhz. i have created a time delay of 2 seconds and used as delay function to blink and led. when i debugged this code, after 2seconds i.e., the timer counter value doesn't reset even though i used the instruction T0TCR=1<<1. please anybody can solve my problem...........
please can anybody help me to solve the below problem. i have been facing this problem since 3days. i.e., cclk=12mhz, pclk=3mhz. i have created a time delay of 2 seconds and used as delay function to blink and led. when i debugged this code, after 2seconds i.e., the timer counter value doesn't reset even though i used the instruction T0TCR=1<<1. please anybody can solve my problem...........
Code:
#include<LPC21xx.h>
#define LED 1<<1
void delay(void);
void main()
{
IODIR0=LED;
T0PR=2999999;
while(1)
{
IOSET0=LED;
delay();
IOCLR0=LED;
delay();
}
}
void delay(void)
{
T0TCR=(1<<1);
T0TCR=(1<<0);
while(!(T0TC==2));
T0TCR=(0<<0);
}
Last edited by a moderator: