[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] Blink period shorter than expected
From: |
dfx |
Subject: |
[avr-gcc-list] Blink period shorter than expected |
Date: |
Sun, 01 Dec 2013 17:41:16 +0100 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 |
I made a very simple circuit for LED to blink.
The code is as follows:
# include <avr/io.h>
# define F_CPU 20000000UL
# include <util/delay.h>
int main (void) {
DDRB | = _BV (DDB0);
while (1) {
PORTB ^ = _BV (PB0);
_delay_ms (10000);
}
}
The processor is an ATMEGA324PA with clock = 20 MHz.
The fuses are:
lfuse = 0x4F
hfuse = 0x99
eFUSE = 0xFF.
The problem is that the period of switching on / off of the LED is
approximately 16 seconds. instead of 20 seconds expected.
Where is the error? What should I check for a period of 20 seconds?
Thank you to those who can help me.
Domenico
PS: I suppose that with a quartz 16 MHz operation would be correct, but
there is a way to use one 20 Mhz?
---
Questa e-mail è priva di virus e malware perché è attiva la protezione avast!
Antivirus.
http://www.avast.com
dfx.vcf
Description: Vcard
- [avr-gcc-list] Blink period shorter than expected,
dfx <=