Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] how to delay LPC2294 without timmer..?

2005-12-14 by Richard Duits

Hi Dennis,

I usually write short delays like this:

void delay(unsigned int ticks)
{
  unsigned int start = Timer0_TC;
  while (Timer0_TC - start < ticks) { }
}


This does not use any match registers, you only need a timer that does 
not reset its counter.

Regards,
Richard.


dennis_arm wrote:

> Hi All !!
> I am new to LPC2294 and wish to produce a small code for delay some
> thing like
>
> void delay (unsigned int Usec)
> {
>    unsigned int delayUsec= ( ?? ) * Usec;          // line 1
>    volatile unsigned int count = 0;                 // line 2
>    for (count = 0; count < delayUsec; count++)      //line 3
>              {asm volatile ("nop");}               // line 4
> }
> where time is the no of micro seconds
> for information I am using a 60MHz crystal on my board
>
> I know it is easy to do with timers 0 and 1 but i wish, NOT to use
> the timers at all as i need them for orther purpose.
> My question
> 1. is that is there any overhead added due to the code in the
> function for the lines 1,2,3,4 ?
> 2. is there any over head due to this "delay(/*some value*/)" being
> called in my over all code.?
>
>           If so how much delay? or where can i get the information?
>
> Am i missing some thing or is there a simple way to do this (to
> caliculate the delay with out using tmmers?)
>
>
> thanks in advance!!
>
> regards,
> dennis.
>
>
>
>
>
> ------------------------------------------------------------------------
> YAHOO! GROUPS LINKS
>
>     *  Visit your group "lpc2000
>       <http://groups.yahoo.com/group/lpc2000>" on the web.
>        
>     *  To unsubscribe from this group, send an email to:
>        lpc2000-unsubscribe@yahoogroups.com
>       <mailto:lpc2000-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>        
>     *  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>       Service <http://docs.yahoo.com/info/terms/>.
>
>
> ------------------------------------------------------------------------
>

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.