PIC 16F877A Port unstable

Discussion in 'Embedded Systems and Microcontrollers' started by mukulkhairatkar, Jun 23, 2010.

  1. mukulkhairatkar

    Thread Starter New Member

    Jun 22, 2010
    6
    0
    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
     
  2. lightingman

    Senior Member

    Apr 19, 2007
    374
    22
    Hello,

    Is the problem on port E or C?

    Can you PM me your circuit and code. I will have a look for you.

    Daniel.
     
  3. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    In this forum we try to avoid using PMs for questions asked in forum. The code and discussion should be posted here
     
  4. lightingman

    Senior Member

    Apr 19, 2007
    374
    22
    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.
     
  5. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    It seems you have left some inputs floating.
     
  6. wannaBinventor

    Member

    Apr 8, 2010
    179
    4
    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.
     
  7. mukulkhairatkar

    Thread Starter New Member

    Jun 22, 2010
    6
    0
    I am sure that all the inputs are pulled up to VCC 5V. It is realated to PORTC and PORTE.

    Please take a look at my schematics attached here with

    Thanks
    MAK
     
  8. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
    Is the processor in low-voltage programing mode? With that circuit, it shouldn't be. In fact, how are you programming it?
     
  9. mukulkhairatkar

    Thread Starter New Member

    Jun 22, 2010
    6
    0
    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
     
  10. lightingman

    Senior Member

    Apr 19, 2007
    374
    22
    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.
     
  11. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312

    Its all in the details. ;)
     
  12. mukulkhairatkar

    Thread Starter New Member

    Jun 22, 2010
    6
    0
    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
     
  13. hemuz

    New Member

    Mar 7, 2010
    14
    0
    I have The same problem !!!!
     
  14. coldpenguin

    Active Member

    Apr 18, 2010
    165
    9
    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)
     
  15. mukulkhairatkar

    Thread Starter New Member

    Jun 22, 2010
    6
    0
    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
     
  16. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    What are the values of the pull up resistors?
     
  17. mukulkhairatkar

    Thread Starter New Member

    Jun 22, 2010
    6
    0
    All the pull up resistors are 10k 0.25 watts
     
Loading...