All pastes #769291 Raw Edit

Someone

public c v1 · immutable
·published 2007-11-11 09:49 UTC
rendered paste body
I've a external 4Mhz Xtal.here's my test:#include <avr/io.h>void delay_ms(unsigned short ms) {unsigned short outer1, outer2;outer1 = 200;while (outer1) {outer2 = 1000;while (outer2) {while ( ms ) { ms--; asm volatile("nop"); }outer2--;}outer1--;}}int main(void){unsigned short duration=5000;//SET OUTPUT PINSDDRD |= (1 << PD6);DDRD |= (1 << PD5);DDRD |= (1 << PD4);while (1) {PORTD |= (1 << PD6);delay_ms(duration);PORTD &= ~(1 << PD6);PORTD |= (1 << PD4);delay_ms(duration);PORTD &= ~(1 << PD4);}return 0;}And makefile:bkw@snigel:~/tmp/code$ cat MakefileMCU=atmega16F_CPU=4000000F_OSC=4000000CC=avr-gccOBJCOPY=avr-objcopy# optimize for size:CFLAGS=-g -mmcu=$(MCU) -Wall -Wstrict-prototypes -Os -mcall-prologuesall: test.hextest.hex : test.out$(OBJCOPY) -R .eeprom -O ihex test.out test.hextest.out : test.o$(CC) $(CFLAGS) -o test.out -Wl,-Map,test.map test.otest.o : test.c$(CC) $(CFLAGS) -Os -c test.c#erase the AVR before it is programmedload: test.hexclean:rm -f *.o *.map *.out