delya in nanosecond mikroc

Discussion in 'Embedded Systems and Microcontrollers' started by akle, Jul 12, 2013.

  1. akle

    Thread Starter New Member

    Jul 12, 2013
    2
    0
    hi.

    I use delay_us in mikroc with pic16f88

    But I want delay in nanoseconds.

    is it possible to achieve this.
     
  2. JohnInTX

    Moderator

    Jun 26, 2012
    2,344
    1,025
    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:
    Code ( (Unknown Language)):
    1. bsf port,bit
    2. 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.
     
  3. akle

    Thread Starter New Member

    Jul 12, 2013
    2
    0
    thank you very much
     
Loading...