Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

ATMEGA644 question/issue?

Status
Not open for further replies.

Robert_G

New Member
[SOLVED] ATMEGA644 question/issue?

I'm a bit familiar with AVR micro's, but I'm having a problem with the basic LED blink test with this particular controller. Every time I try to just turn an LED on or off via GPIO port, the LED blinks very quickly. Uc is hooked up with basic ISP, internal osc at 8mhz, no divider, jtag disabled, on board debugging disabled, 5V supply I know is good. I'm not telling it to blink, even trying to pwm a led it does the same blink, code is:

#include <avr/io.h>

int main(void)
{
DDRB |= (1<<0);
PORTB |= (1<<0);
for(;;) { }
}

Very simple, should just turn PORTB.0 to high and leave it. This works on Attiny2313 and atmega168's as expected, but on the 644 it causes a constant blink.

I must have missed some single line in the datasheet or something, but I've looked a few times for an answer. Google is also not turning up this question so I'm assuming I'm making a VERY noob mistake. Just want to solid on a port, any suggestions?

Thanks in advance!
Robert
 
Last edited:
Part of your code was converted into a smiley face. You can go to edit, then "go advanced". Look for the "#" symbol which will wrap your code in
Code:
 tags.

 
[CODE]
#include <avr/io.h>
int main(void)
{
   DDRB |= (1<<0);
   PORTB |= (1<<0);
   for(;;) { }
}
 
Ahh, indeed it was, thank you for the tip.

And also, I've got the problem fixed. Turns out the Watchdog fuse was enabled and causing my uC to continuously restart very quickly. I had disabled it before while trying to figure this out, but when I disabled the fuse, I only reset the uC, I did not power it off and back on. Seems some fuses will not obey a change without a complete power cycle to chip. Live and learn, thanks!
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top