embedded design, delay routine question
Hi guys. I have prtty much completed an embedded design project I am working on, a spinning LED persistance of vision display. Every aspect of the program works fine apart from the delay routine.
For interests sake, here is my program (it's heavily annotated):
C code - 270 lines - codepad
Basically, all I need to do is create a delay routine which takes in a 0-65535 number, and delays for that many microseconds. So a value of 43 passed into the routine creates a delay for 43us.
The PIC is set at 4MHz, so each instruction takes 1us. I suspect there is going to have to be a set, small delay for the routine to start so that has been accounted for. I suspect I am going to be using assembly in the C code also.
Any help is greatly appreciated.