Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: Delay issue

2008-09-08 by englsprogeny

Thanks Julian

I was using an older version of Winavr.  This older varsion has a 
32ms limit on its delays.  If I want longer delays I can switch to a 
newer WinAVR or do multiple iterations.

Thanks again for your input.



-- In AVR-Chat@yahoogroups.com, "Julian Higginson" <julian.h@...> 
wrote:
>
> Are you driving this code as you showed here, always using 
constants for the
> delay time? Or was this a simplified code snippet for clarity?
> 
> Because if you use variables in a call to _delay_ms() I'm pretty 
sure you
> need the floating point maths library included for it to do what 
you want.
> 
> 
> Hope this helps,
> 
> 
> Julian Higginson
> Bruttour International P/L
> http://www.bruttour.com.au
> Ph: +612 9987 1581
> 
> -----Original Message-----
> From: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] On 
Behalf
> Of englsprogeny
> Sent: Saturday, 6 September 2008 1:25 AM
> To: AVR-Chat@yahoogroups.com
> Subject: [AVR-Chat] Delay issue
> 
> I am setting 2 outputs high (n milliseconds apart)
> 
> Problem is that when I look at them with my logic analyzer, the
> distance between them going high isn't always what I've coded.
> 
> My configuration is:
> 
> Compiling with WinAVR 
> ATMega8
> External clock (8Mhz crystal)
> My Fuses are set correctly
> 
> -------------------------------
> 
> I've modified the makefile to have:
> 
> F_CPU = 8000000
> 
> 
> 
> -------------------------------
> C Source:
> 
> 
> #include <avr\io.h>
> #include <avr\delay.h>
> 
> int main(void) 
> {	
> 	
> 	//set port c as all output
> 	DDRC = 0xff;
> 	
> 	PORTC = 0x20;
> 		
> 	_delay_ms(37);	
> 	
> 	PORTC |= 0x10;
> 	
> 	
> }
> 
> 
> At 30 ms the timing is correct.  Anything above or below 30ms, the
> timing moves in the right direction but not in correct proportion.
> 
> Maybe it's my [PC based] logic analyzer.
> Thanks for your suggestions.
> 
> 
> 
> 
> ------------------------------------
> 
> Yahoo! Groups Links
>

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.