ATMega16L-8PU strange behaviour

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I mada a really simple program. It must send a logical 0 to all ports in order to turn leds on. I put an ATMega16 8PU on the STK500 and I transferred the C code inside it. Nothing happened. All led off. The code was too simple so i thought there were something wrong with the microcontroller. I used instead an ATMega8535. The same code (no change were made) now works perfectly. What could be the problem? I have to use ATMega16 for a more complex project

 

Here's the code

#define F_CPU 40000UL  //4 MHz
#include <avr/io.h>




int main(void)
{
	DDRA=0b11111111;
	PORTA=0b00000000;
	DDRB=0b11111111;
	PORTB=0b00000000;
	DDRC=0b11111111;
	PORTC=0b00000000;
	DDRD=0b11111111;
	PORTD=0b00000000;
	while(1)
	{


		
	}
}

EDIT:

The microcontroller was broken so i tested the program with other 2 ATMega16. All ports works perfectly exept portC. PC0,PC1,PC6 and PC7 have a logical 0 but the other pins has a logical1.

 

Last Edited: Sat. Mar 28, 2015 - 05:42 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

See my signature ;-) 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I feel like an idiot. After a short search about JTAG i solved the problema. Thank you very much