Make a LED flash with Atmega32
Discussion in "AVR Discussion Forum" started by Ouin85 Feb 9, 2015.
Mon Feb 09 2015, 04:10 pm
Hello,
I wish to make a LED flash with Atmega32.
I banged the program WinAVR, I compiled him and sent on the flash memory of Atmega32 successfully.
But, nothing works.
I noticed that the hexadecimal file and the contents of the memory are not identical.
What that can be.
I tried with AvrStudio, the same result.
Thank you.
The program is :
I wish to make a LED flash with Atmega32.
I banged the program WinAVR, I compiled him and sent on the flash memory of Atmega32 successfully.
But, nothing works.
I noticed that the hexadecimal file and the contents of the memory are not identical.
What that can be.
I tried with AvrStudio, the same result.
Thank you.
The program is :
#include <avr/io.h> #include <util/delay.h> int main(void) { DDRD = 0b10000000; while(1) { PORTD = 0b10000000; _delay_ms(1000); PORTD = 0b00000000; _delay_ms(1000); } return 0; }
[ Edited Tue Feb 10 2015, 10:13 am ]
Tue Feb 10 2015, 10:16 am
You need to provide CPU frequency for _delay_ms() function to work properly.
/* F_CPU must be defined to your CPU frequency */ #define F_CPU 4000000UL /* This is just example 4Mhz */ #include <avr/io.h> #include <util/delay.h>
Powered by e107 Forum System