View previous topic :: View next topic |
Author |
Message |
MOHSEN Guest
|
Delay |
Posted: Fri May 13, 2005 7:16 am |
|
|
Hello everyone, does anyone know how to use the delay function in the CCS compiler to delay nano seconds. i know how to delay micro and milli seconds but i dont know if it delays nano seconds. Thank you. |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Fri May 13, 2005 7:56 am |
|
|
Thinking a microcontroller as a clocked state machine, you will know that they use
a crystal or a resonator as a clock source. This clock source is then divided
internally by 4 to get the internal clock speed that define a minimum time width or
internal transition state. Inside that time the micro must execute every instruction.
For example a 4.0 Mhz crystal oscillator is divided internally by 4 wich give an
internal 1.0 Mhz clock, whose period is 1 microsec.
Following this criteria:
40.0 Mhz will give 100 nanosec period.
400.0 Mhz will give 10 nanosec period.
4000.0 Mhz will give 1 nanosec period.
When Microchip & technology enable us to get a PIC running at 4.0 Ghz surelly you
will get a CCS compiler with the built in function: delay_ns()
Best wishes,
Humberto |
|
|
MOHSEN Guest
|
delay |
Posted: Fri May 13, 2005 8:11 am |
|
|
Thanks a lot, you've been a great help |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri May 13, 2005 11:50 am |
|
|
Look at the CCS function delay_cycles() in the manual or the Help file.
For a 20 MHz crystal, delay_cycles(1) will give a delay of 200 ns. |
|
|
|