Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

ATMEGA32 PORTC problem

Status
Not open for further replies.

ANS HAFEEZ

Advanced Member level 4
Full Member level 1
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 :cry:

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

MCUCSR Bit 7 – JTD: JTAG Interface Disable

When this bit is zero, the JTAG interface is enabled if the JTAGEN Fuse is programmed. If this
bit is one, the JTAG interface is disabled. In order to avoid unintentional disabling or enabling of
the JTAG interface, a timed sequence must be followed when changing this bit: The application
software must write this bit to the desired value twice within four cycles to change its value.

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

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top