PIC 16F877A Port unstable

Thread Starter

mukulkhairatkar

Joined Jun 22, 2010
6
Guys,

I am fairly new to Hardware design and PIC programming currently working on PIC 16F877A. I have initialized PORTA and PORTB in input mode and PORTC and PORTE in output mode. Based on logic present the input port, I am setting logic on output port. In idle condition output ports remain zero. But sometimes it jumps to logic 1 and then back to zero. This behavior is pretty random and I am not able to understand the problem. Do you have any suggestion or possibilities I can try to stop this unwanted oscillation?

I am using simple while loop to run the operation and if/else statements to compare input port logic. I am sure that MCLR pin is set to high while running this operation.

any help is appreciated... Thanks in advance

MAK
 

lightingman

Joined Apr 19, 2007
374
Ok.

Point taken....

maybe the circuits and code could be posted here. I am just aware that where code and schematics are concerned, some people may wish to keep a design to themselves for copyright reasons. I hope this explains......

Daniel.
 
It seems you have left some inputs floating.
This sounds like the problem. If the input is floating (without a pull up or pull down resistor) it is apt to dance between logic levels as it picks up random signals.

I'm not familiar with that PIC, but I do know that certain PORTS on certain PICs have internal pullup resistors than can be configured through the options register (I think) in the software.
 

John P

Joined Oct 14, 2008
2,026
Is the processor in low-voltage programing mode? With that circuit, it shouldn't be. In fact, how are you programming it?
 

Thread Starter

mukulkhairatkar

Joined Jun 22, 2010
6
I am programming using PiCkit 2 using ICSP mode.....The lower part of circuit is power supply and ICSP header which I did not post (just lazy...nothing else)

MAK
 

lightingman

Joined Apr 19, 2007
374
Hi again,

You are talking about the PIC16F877A. Your schmatic is showing the PIC16F877. They are slightly different. You may have to change the settings of some of the registers.

Daniel.
 

Thread Starter

mukulkhairatkar

Joined Jun 22, 2010
6
Daniel,

Actually the problem is with PIC16F877A....My schematic program has only PIC16F877 in the library so just for schematics I am using PIC with that convention.

MAK
 

coldpenguin

Joined Apr 18, 2010
165
What is J2?

Using this PIC, and the Hitec C compiler (9.70), I was finding that calling a routine which set RD7 low, also set RD6 low.
I initially thought it was a floating input/output (as I had bread-boarded I thought it would be prone to this), but I traced it to a compiler problem (multiple chips show the same effect)
 

Thread Starter

mukulkhairatkar

Joined Jun 22, 2010
6
J2 is the connector head for PORTD for future use. I have that provision on my PCB. PORTD is not initialized in the software so its effect on rest of the port is out of question. I am using CC5X compiler and MPLAB IDE for development, PicKit2 for programming.

MAK
 
Top