CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Delay

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
MOHSEN
Guest







Delay
PostPosted: Fri May 13, 2005 7:16 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri May 13, 2005 7:56 am     Reply with quote

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() Wink


Best wishes,

Humberto
MOHSEN
Guest







delay
PostPosted: Fri May 13, 2005 8:11 am     Reply with quote

Thanks a lot, you've been a great help Smile
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri May 13, 2005 11:50 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group