Discussion in "AVR Discussion Forum" started by    Ouin85    Feb 9, 2015.
Mon Feb 09 2015, 04:10 pm
#1
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 :

#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, 12:01 am
#2
As such a simple test does not work we will need your full
circuit diagram.
Are you sure the LED is the right way round ?
 Ouin85 like this.
Tue Feb 10 2015, 10:16 am
#3
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>

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

DonaldJAX
Fri Apr 19 2024, 01:08 pm
Lewisuhakeply
Thu Apr 18 2024, 06:00 pm
Darrellciz
Thu Apr 18 2024, 11:07 am
Charlessber
Thu Apr 18 2024, 09:29 am
BartonSem
Thu Apr 18 2024, 04:56 am
DonaldKnown
Thu Apr 18 2024, 12:24 am
utaletxcyw
Wed Apr 17 2024, 10:21 am
Anthonyvab
Wed Apr 17 2024, 08:48 am