Hello, If you use the internal RC oscillator you probably need to calibrate your Atmega. It may possibly resolve your problems of time, look at OSCCAL register in datasheet. You have some application note on the web site of Atmel who can help you to automatically calibrate your Atmega.
http://www.atmel.com/dyn/resources/prod_documents/doc2555.pdf http://www.atmel.com/dyn/resources/prod_documents/doc8002.pdf -----Message d'origine----- De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Envoyé : jeudi 28 juin 2007 00:24 À : [email protected] Objet : [avr-gcc-list] Unusually Long Delay for ATMega128 Thanks, everyone for your suggestions. After lots of tests the problem, here appears to be related not to my timer code, but rather in the way my I2C messages are being decoded on my host system (a gumstix). I will now look at these next. Daniel > Date: Wed, 27 Jun 2007 10:27:10 -0500 (CDT) > From: [EMAIL PROTECTED] > Subject: [avr-gcc-list] Unusually Long Delay for ATMega128 > To: [email protected] > Message-ID: > <[EMAIL PROTECTED]> > Content-Type: text/plain; charset="iso-8859-1" > > Hi, > > I am working on some code to read the Parallax Ping sensor from a board > (robostix) with an ATMega128 microcontroller. Unfortunately, I am getting > some strange tick counts from my functions. For example, in my Sensor.c > file, I start the counter, then call a function to delay for 5 > microseconds, then read the counter value. I have repeated this process > several times, and I generally see about 350 ticks after my routine -- > this converts to about a 20 microsecond delay. Am I missing anything > pretty obvious in my Timer.h and Timer.c files? > > Thanks, > Daniel _______________________________________________ AVR-GCC-list mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/avr-gcc-list _______________________________________________ AVR-GCC-list mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
