私は Atmegas ant AVR プログラミングに非常に慣れていないので、この初心者の質問を許していただければ幸いです。1MHZ で完全に動作するこのコードを取得しましたが、F_CPU 周波数を 8 MHZ に変更しながら Atmega を内部 8 MHZ に融合すると同様に、LED が速く点滅しています。C コンパイラが私の新しい周波数を無視しているようです。誰かが私を助けることができます;)?
#define F_CPU 8000000UL
#include <util/delay.h>
#include <avr/io.h>
int main(void)
{
while(1)
{
//TODO:: Please write your application code
/* set PC0 on PORTC (digital high) and delay for 500mS */
PORTD &= ~_BV(PD5);
_delay_ms(500);
/* PC0 on PORTC (digital 0) and delay for 500mS */
PORTD |= _BV(PD5);
_delay_ms(500);
}
}
次のコマンドでコンパイルされます。
avr-gcc -g -Os -mmcu=atmega8 -c test.c
avr-gcc -g -mmcu=atmega8 -dF_CPU=8000000UL -o flash.elf test.o
avr-objcopy -j .text -j .data -O ihex flash.elf flash.hex
お時間とご協力ありがとうございます ;) Delay.h: http://pastebin.com/wzppfma3