HI I am using LPC2378 microcontroller...running at CCLK=68.57MHz. I want a delay of 1us. Plz tell if this function is correct or not??
#define MICROSECONDS(x) (x*15)
__asm void delayhk(unsigned int a_microseconds) { loop MOVS R1, R0 SUB R0, R0, #1 BNE loop BX LR }
Usage: delay(MICROSECONDS(10));
I have copied this above code from one of the thread...but in that they were using 72Mhz.. If i continue with this code only without changing my settings of system clock it would generate a lag of .291545 usec. I am a student, Plz tell any alternative for the same. Thanks