SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions on the software and hardware for Atmel's STK standard.
User avatar
By payam
#122507
My goal is Turn on and Off a LED But I did not succeed.(battery is 6 or 7 volts)

Image


Too , I use the internal crystal and This is my code.
Code: Select all
#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);
  }
}
Image
By n1ist
#122512
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
User avatar
By payam
#122527
n1ist wrote: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 ?
By n1ist
#122536
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