Hello All,
I am trying to have a function for the delay with the following code. But when executed, I do not get the delay of 1000 ms. Please advise where I am wrong.
#include <lpc214x.h> void delay(unsigned int milli); int main(void) { IO0DIR|=(1<<1); T0PR=0x00003A97; // Prescaler to Match 1 ms T0CTCR=0x00; // Timer Mode T0TCR=0x02; while(1) { IO0SET|=(1<<1); delay(1000); IO0CLR|=(1<<1); delay(1000); } } void delay(unsigned int milli) { T0TCR=0x02; // Reset T0TCR=0x01; // Enable while(T0TC<milli); T0TCR=0x00; }
Thanks for your Time!
Hello All
Sorry. I am running pclk @ 15 Mhz.
Thanks