delya in nanosecond mikroc

Thread Starter

akle

Joined Jul 12, 2013
2
hi.

I use delay_us in mikroc with pic16f88

But I want delay in nanoseconds.

is it possible to achieve this.
 

JohnInTX

Joined Jun 26, 2012
4,787
If you are looking for very short ns-based delays you are out of luck. The compiler-generated delay routines simply count off machine cycles. In a 20MHz PIC for example, each machine cycle is 200nsec. The minimum delay you could get on that part would be 200ns. An example you could see on an IO port would be:
Rich (BB code):
bsf port,bit
bcf port,bit
which would have 200 ns between the port actions. That's the best you can do.

Likewise, a single NOP is the smallest delay available, it would also have a 200ns minimum time at 20MHz.
 
Top