Problem at startup(CodeVisionAVR)

My goal is Turn on and Off a LED But I did not succeed.(battery is 6 or 7 volts)

http://up.vatandownload.com/images/bdjv … cczciw.jpg

Too , I use the internal crystal and This is my code.

#include <mega16.h>
#include <delay.h>
/*This is a program that flashes the Led
  on PORTA.0 every 0.5 seconds*/  
main()
{
  while(1)   /*Loop forever*/
  {
     PORTA.0=1;
     delay_ms(500);
     PORTA.0=0;
     delay_ms(500);
  }
}

http://up.vatandownload.com/images/urli … 2wbdkw.jpg

You need to set DDRA to make the pin an output.

I’m not sure what you mean by “battery is 6 or 7 volts”. If you feed that high a voltage to the ATMega16 directly, you will burn it out. If you are using a 7805-family regulator, it’s too low; they need 2v headroom so I would use at least 7 volts.

/mike

n1ist:
You need to set DDRA to make the pin an output.

If you are using a 7805-family regulator, it’s too low; they need 2v headroom so I would use at least 7 volts.

My friend

I set up microcontroller with +5 volts , no more. Why is 7805 regulator too low !?

Too, I want to know that How can be activated the microcontroller internal crystal in the CodeVisionAVR

Do i set rightly at the Image ?

According to the datasheet of the 7805 (here’s the link for [National’s version) the dropout voltage is 2V. The dropout voltage is the minimum voltage that the input has to be above the output for the regulator to work properly. So for a 5 volt regulator, you must supply at least 5 + 2 or 7 volts.

To reduce heat dissipation, you don’t want to go much above that voltage or may have to provide heatsinking or additional cooling.

I am not familiar with Codevision (I use WinAVR). In WinAVR, you don’t set the fuses in the compiler; you set them with the programmer. Codevision may do this in the IDE.

/mike](http://www.national.com/ds/LM/LM340.pdf)

I found the answer with many tests , Internal crystal set according to Pictures below :

http://up.vatandownload.com/images/g355 … tscmge.jpg