rangerskm
Full Member level 4
- Joined
- Jan 23, 2013
- Messages
- 199
- Helped
- 0
- Reputation
- 2
- Reaction score
- 0
- Trophy points
- 1,296
- Activity points
- 2,663
i am trying to write my first code using arm timers ,i am not clear in the timer programming ,any how i am tried to write the code ,in isis proteus ,its not generating 1 sec delay to blink the led,dont know the error in it.please help me in it ,
if possible share me links to learn timers and pll .
thanks in advance
if possible share me links to learn timers and pll .
thanks in advance
Code:
#include <lpc21xx.h>
void timerinit();
void delayms(unsigned int ms);
void pllinit();
int main()
{
IO0DIR|=0XFFFFFFFF;
pllinit();
timerinit();
while(1)
{
IO0SET=0XFFFFFFFF;
delayms(10);
IO0CLR=0XFFFFFFFF;
}
}
void pllinit()
{
PLLCFG=0X00000024;
PLLCON=0X00000001;
PLLFEED=0X000000AA;
PLLFEED=0X00000055;
while(!(PLLSTAT&0X00000400));//TEST LOCK BIT
PLLCON=0X00000003;
PLLFEED=0X000000AA;
PLLFEED=0X00000055;
VPBDIV=0X00000002;
}
void timerinit()
{
T0TCR=0X00;
T0PR=60000;
}
void delayms(unsigned int ms)
{
T0TCR=0X00;
T0TCR=0x01;
while(T0TC<ms);
T0TCR=0X00;
}