PIC Microcontroller Problems

Discussion in 'Embedded Systems and Microcontrollers' started by solpic, Jul 31, 2009.

  1. solpic

    Thread Starter Member

    Jul 23, 2009
    25
    0
    Hello everyone,

    This is my first time working with microcontrollers and I have encountered some unusual problems. I am using the PIC16F877A microcontroller and the PIC-PG2C programmer. Now after a few failed download attempts to the microcontroller, I realized that I had the wrong device in IC-Prog. I only tell you this because I thought it could have contributed to the problem. After I finally downloaded and verified the code on a DIFFERENT pic16f877a microcontroller, I put it into a circuit based off the one found on this page, http://www.instructables.com/id/EH60B0AZU1EP286TH9/, except with the LED on port A bit 0 and instead of a 4.7k resistor I had a potentiometer that was dialed to about 5k. My 5V voltage source was an LM7805C voltage regulator with a nine volt battery connected to the input, a 100uF capacitor connecting the input to the ground with the positive terminal on the input, the ground of the 7805C connected to the 9V battery ground, another 100uF capacitor connecting the output to ground with the positive terminal on the output, and the output connecting to the circuit. The circuit worked until I tried to reprogram the PIC. After that I was not able to reprogram it at all so I tried using the microcontroller that I had originally used but had put the wrong device in IC-Prog. When I used that I was able to successfully program and verify the code but when I put it into the circuit, the LED did not light up until I jiggled the LED in it’s breadboard socket. Now at first I thought it was a bad breadboard connection, but then I discovered that after I jiggled the LED for a while and it lit up, and then pulled it out of the socket, and then placed it back in it immediately lit up without the need for further jiggling. Now I am very confused as to why these events occurred, and I am sorry if this narrative was a little too detailed but I wanted to make sure the problem was apparent. Furthermore, I was able to program a pic16f84a chip 4 times without any problems but I did not place it into the circuit. Anyway, any help would be greatly appreciated.
     
  2. rjenkins

    AAC Fanatic!

    Nov 6, 2005
    1,015
    69
    Have you got Pin 1 pulled to +5V?

    If that pin is floating, moving near it may well reset / un-reset the device.
     
  3. solpic

    Thread Starter Member

    Jul 23, 2009
    25
    0
    Pin 1 is connected to 5V with the potentiometer at 5 kiloohms in between.
     
  4. rjenkins

    AAC Fanatic!

    Nov 6, 2005
    1,015
    69
    ah.. I think this is one of the devices with 'Low voltage programming' enabled by default.

    Pin RB3 needs pulling to either 0V or 5V (I can't remember which) for the chip to run.
    To make it work as a normal I/O pin you need to set a configuration bit to disable 'low voltage in circuit programming'.
     
  5. BinyaminTsadik

    New Member

    Aug 11, 2010
    1
    0
    RJENKINS thank you, I had the same issue. I was trying to use RB3 as an output and my entire chip got messed up.

    Just had to use the command (ASM):

    __CONFIG config1, _LVP_OFF

    Thanks again

    Binyamin
     
  6. debjit625

    Well-Known Member

    Apr 17, 2010
    790
    186
    Ok first check your programmer is it a low voltage or high voltage programmer ,if its a high voltage programmer then check is the LVP pin RB3 is connected to ground using a pulldown resistor 10K ,next check all the power supply pin are connected i.e.. all Vdd pins should be connected to +5V and all Vss pins should be connected to 0V ,third when programming with high voltage disable the LVP bit off and if you dont provide an external reset circuit then also turn on the Power-on Reset config.

    Now when running the pic provide a proper reset circuit if Power-on Reset config is on then just tie up a 10K resistor to Vdd from MCLR pin.Next connect all the Vdd and Vss pins.

    Your main problem may be that you have not connected all the Vss and Vdd pins properly.

    Good Luck
     
Loading...