closed

Loginbox

Please enter your username and password into the following fields to log in.


  • Username:
  • Password:
  •  
  • Auto log in on every visit.


  •  

Delay loop generator



Avra hidden
Schreiberling
Avatar
Gender: male
Location: SERBIA  Belgrade, Serbia
Age: 49
Posts: 624
Registered: 07 / 2002
Homepage Private message
Subject: Delay loop generator  -  Posted: 03.01.2008 - 09:42   -  
You must be logged in or your permissions are to low to see this Attachment(s).
This post has been edited 1-times. Last edit: 22.08.2011 - 10:00 by Avra.
go down go up
Merlin offline
Schreiberling
Avatar
Gender: male
Location: UNITED KINGDOM 
Age:
Posts: 884
Registered: 03 / 2005
Private message
Subject: Re: Delay loop generator  -  Posted: 03.01.2008 - 10:25   -  
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.
Merlin.

:magic:

Software is a black art.
go down go up
Avra hidden
Schreiberling
Avatar
Gender: male
Location: SERBIA  Belgrade, Serbia
Age: 49
Posts: 624
Registered: 07 / 2002
Homepage Private message
Subject: Re: Delay loop generator  -  Posted: 03.01.2008 - 11:17   -  
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.
go down go up
Merlin offline
Schreiberling
Avatar
Gender: male
Location: UNITED KINGDOM 
Age:
Posts: 884
Registered: 03 / 2005
Private message
Subject: Re: Delay loop generator  -  Posted: 03.01.2008 - 11:27   -  
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.
Merlin.

:magic:

Software is a black art.
go down go up
rh offline
Administrator
Avatar
Gender: male
Location: GERMANY  Germany
Age:
Posts: 5486
Registered: 03 / 2002
Homepage Private message
Subject: Re: Delay loop generator  -  Posted: 03.01.2008 - 12:02   -  
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
Cars don't buy cars -- Autos kaufen keine Autos.
Henry Ford
go down go up
Avra hidden
Schreiberling
Avatar
Gender: male
Location: SERBIA  Belgrade, Serbia
Age: 49
Posts: 624
Registered: 07 / 2002
Homepage Private message
Subject: Re: Delay loop generator  -  Posted: 04.01.2008 - 09:38   -  
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).
go down go up
Avra hidden
Schreiberling
Avatar
Gender: male
Location: SERBIA  Belgrade, Serbia
Age: 49
Posts: 624
Registered: 07 / 2002
Homepage Private message
Subject: Re: Delay loop generator  -  Posted: 07.10.2010 - 09:16   -  
Nice cycle accurate delay: from 1 cycle to 536 seconds.
http://www.avrfreaks.net/index...pe=project
go down go up
Avra hidden
Schreiberling
Avatar
Gender: male
Location: SERBIA  Belgrade, Serbia
Age: 49
Posts: 624
Registered: 07 / 2002
Homepage Private message
Subject: Re: Delay loop generator  -  Posted: 05.01.2011 - 02:59   -  
And another one, which produces very compact ASM code:
http://bretm.home.comcast.net/~bretm/avrdelay.html

UPDATE: This is new URL: http://bretmulvey.com/avrdelay.html
This post has been edited 1-times. Last edit: 29.02.2016 - 14:05 by Avra.
go down go up
 


Registered users in this topic
Currently no registered users in this section

Delete cookies of this forum  •  FAQ / Help  •  Team page  •  Imprint   |  Local time: 19.02.2020 - 01:43