hi i want delay in ms and us.am using LPC2366.CPU clock: 48MHz.peripheral clock: 12MHz.can any one have source code for delay function.please help me to know how to implement delay function in ms and us.Thanks i advance.
Making life black or white is a boring way to live. There is quite a lot of shades in between too... I agree that there is more than one way to skin this cat, timer or assembler delay loop. I also agree that, when long enough, delay by timer is preferrable. HOWEVER I must insist that a delay loop in C is "delay some unknown time" The only C delay loop I would consider (although ridiculous) acceptable would be to figure out how many cycles the most efficient compiler would use and apply that where a delay is only specified as "not less than" and longer delay than minimum is no problem.
a footnote on asembler delays that should ALWAYS have the following $IF (clock == xxx) $else change the code here $endif
Erik