ATMEGA32 PORTC problem

Status
Not open for further replies.

ANS HAFEEZ

Advanced Member level 4
Joined
Jul 25, 2013
Messages
101
Helped
5
Reputation
10
Reaction score
5
Trophy points
1,298
Location
LAHORE,PAKISTAN
Visit site
Activity points
1,911
Salam
i am using portC of atmega32 as a input port and connect PORTC with pulldown resistor but getting problem on PC4 and PC3
my programm is perfect simulation is perfect but when input comes from PC4 and PC3 pin i get No out put

getting similer problem on output PC2 and PC3 pins consistently on 1.79V even if there is logic 1 or 0

Any solution
 

ok ok i got one that i should disbale JTAG for the proper I/O operation
but how to disable it
i disbale it from fus bits in ponyprog but got the same problem

So How to disable it FROM PROGRAMMING

Code:
ch=usart_getchar();
		if (ch==48)
		{
			PORTC=0b00001111;
			PORTA=0b00011111;
		}
		else if (ch == 49)
		{
			PORTC=0b00000001;			//FOR ONE 
			PORTA=0b00010111;
		}
		else if (ch == 50)
		{
			PORTC=0b00000010;			//FOR TWO
			PORTA=0b00011011;
		}
		else if (ch == 51)
		{
			PORTC=0b00000011;			//FOR THREE
			PORTA=0b00011101;
		}
		else if (ch == 52)
		{
			PORTC=0b00000100;			//FOR FOUR
			PORTA=0b00011110;
		}
		else if ( ch == 53)
		{
			PORTC=0b00000101;			//FOR FIVE
			PORTA=0b00001111;
		}
 

Here is the relevant part of the datasheet

JTAG Interface and On-chip Debug System

There are three alternative ways to disable On-chip debug

•Disable OCDEN Fuse.
•Disable JTAGEN Fuse.
•Write one to the JTD bit in MCUCSR.

and


So you need to use

Code:
MCUCSR |=(1<<JTD);
MCUCSR |=(1<<JTD);

and it's best to disable interrupts while executing these two lines to make sure they are not interrupted.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…