Delay loop generator

Avra
Schreiberling
Avatar
Gender:
Location: Belgrade, Serbia
Age: 53
Homepage: rs.linkedin.com/in…
Posts: 653
Registered: 07 / 2002
Subject:

Delay loop generator

 · 
Posted: 03.01.2008 - 08:42  ·  #1
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1362
Registered: 03 / 2005
Subject:

Re: Delay loop generator

 · 
Posted: 03.01.2008 - 09:25  ·  #2
There are a few gotchas here.

R17 and R18 are an unexpected choice. R17 is _ACCA, but _ACCB (the obvious partner) is R16.

R17 in particular is well used so you need to PUSH and POP both registers which takes up a number of cycles (2 each - a total of 8 cycles).

Obviously you need to disable and enable interrupts, which might need to be taken into account.

Finally, in AVRCo assembler, the labels must be on separate lines.

Regards

Merlin.
Avra
Schreiberling
Avatar
Gender:
Location: Belgrade, Serbia
Age: 53
Homepage: rs.linkedin.com/in…
Posts: 653
Registered: 07 / 2002
Subject:

Re: Delay loop generator

 · 
Posted: 03.01.2008 - 10:17  ·  #3
I am aware of needed changes (it is designed for AVR Studio, not for AvrCo), but it is interesting anyway for some special applications. Registers are chosen from a drop list so we can choose ones which are more friendly with AvrCo and avoid PUSH/POP. I don't need this delay very often so it would not pay off to make this small application that generates real AvrCo code by my self, so I can live with it's faults that can be hand corrected.
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1362
Registered: 03 / 2005
Subject:

Re: Delay loop generator

 · 
Posted: 03.01.2008 - 10:27  ·  #4
Ah I see.

I missed the fact that it is an application that generates the code - even though it is obvious. Doh!

My apologies.

Merlin.
rh
Administrator
Avatar
Gender:
Location: Germany
Age: 24
Homepage: e-lab.de
Posts: 5558
Registered: 03 / 2002
Subject:

Re: Delay loop generator

 · 
Posted: 03.01.2008 - 11:02  ·  #5
Hello Avra,

and what about the "uDelay" of AVRco? Or the sDelay? Or the mDelay? Or SysTimers?
Is there really a need for such a delay generator?

rolf
Avra
Schreiberling
Avatar
Gender:
Location: Belgrade, Serbia
Age: 53
Homepage: rs.linkedin.com/in…
Posts: 653
Registered: 07 / 2002
Subject:

Re: Delay loop generator

 · 
Posted: 04.01.2008 - 08:38  ·  #6
Once I needed that to generate very short and specific signals in interrupt. Another appliance that comes to my mind is tv/video signal generation. Speaking of video, that's one of the reasons I am looking forward for XMEGA. :lupe: With fast 2Msps ADC, frame grabbing is possible without external components (it can all fit in RAM since I need just 1 FPS and 32x32 in 16 grays).
Avra
Schreiberling
Avatar
Gender:
Location: Belgrade, Serbia
Age: 53
Homepage: rs.linkedin.com/in…
Posts: 653
Registered: 07 / 2002
Subject:

Re: Delay loop generator

 · 
Posted: 07.10.2010 - 07:16  ·  #7
Avra
Schreiberling
Avatar
Gender:
Location: Belgrade, Serbia
Age: 53
Homepage: rs.linkedin.com/in…
Posts: 653
Registered: 07 / 2002
Subject:

Re: Delay loop generator

 · 
Posted: 05.01.2011 - 01:59  ·  #8
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 15 · Cache Hits: 14   109   123 · Page-Gen-Time: 0.026449s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI