Author Topic: Microsec delay function  (Read 9086 times)

Offline frank

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Microsec delay function
« on: January 08, 2010, 10:36:28 PM »
Is there a microseconds delay function in uTasker ?. I am looking for a simple delay function something like,

delay ( microseconds )

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: Microsec delay function
« Reply #1 on: January 08, 2010, 11:12:45 PM »
Hi Frank

Yes there is a simple delay called

extern void fnDelayLoop(unsigned long ulDelay_us)

This is simply a tuned loop (corrects approximately to respect the processor speed) and so gives approx delays in the us region (if interrupt occur the loop takes a little longer). You will have to check to see what is the longest delay possible since it is processor and clock dependent.

If you need very accurate delays it is best to use a timer (PIT or DMA timer). There are example of the interface routines in ADC_Timers.h.

Regards

Mark