Yahoo Groups archive

AVR-Chat

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

Message

Re: delay time is not reliable

2012-08-31 by englsprogeny1

I have the same issue with a different board and build process.


I've done this on my ATMega8 board now, building the HEX file using make.

crystal 8Mhz


I put the F_CPU value in the makefile as well as the global.h file.

I program the ATMega8 board by way of ISP then unplug the programmer from the ISP header.

When I look at the signal, I get between 0.9 and 2.1ms (about)for a call for 5ms.

When I try 10ms delay, I get between 2 and 4ms delay.




An interesting note: 

When I call the microsecond delay I am solid!

_delay_us(333);

Whatever value I tell it to wait, it is exact!

:)



So milliseconds does not work but microseconds does....






--- In AVR-Chat@yahoogroups.com, John Samperi <samperi@...> wrote:
>
> At 03:26 PM 31/08/2012, you wrote:
> >2.  F_CPU is set correctly
> >#define F_CPU          7372800
> 
> But is this what you have in the project settings? _delay_ms is pretty
> accurate if it has the correct information.
> 
> Are you using your own makefile or the Studio generated one?
> 
> 
> 
> Regards
> 
> John Samperi
> 
> ********************************************************
> Ampertronics Pty. Ltd.
> 11 Brokenwood Place Baulkham Hills, NSW 2153 AUSTRALIA
> Tel. (02) 9674-6495
> Website  http://www.ampertronics.com.au
> *Electronic Design * Custom Products * Contract Assembly
> ********************************************************
>

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.