Yahoo Groups archive

Lpc2000

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

Message

Re: how to delay LPC2294 without timmer..?

2005-12-18 by dennis_arm

Thank u Richard,

I hope this works for me.

but i am still left with my questions
about the overhead due to the inlization and comparing ..
in while and for loops..
 can u say something on this pls?

regards,
dennis
--- In lpc2000@yahoogroups.com, Richard Duits <yahoo@r...> wrote:
>
> 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.
> >
> >
> >

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.