erratic serout behaviour when PICkit2 disconnected

Discussion in 'Embedded Systems and Microcontrollers' started by tracecom, Mar 12, 2013.

  1. tracecom

    Thread Starter AAC Fanatic!

    Apr 16, 2010
    3,871
    1,394
    I have had three different circuits with three different PICs connected to my serial LCD. In two out of the three cases, the LCD behaved erratically when the PICkit2 was disconnected. In all cases the power was coming from the same 5V adapter. I have installed bypass caps, but to no avail.

    What could there be about having the PICkit2 connected that stops the erratic behavior of the PIC serout to the LCD?

    Thanks
     
  2. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    Have not often experienced bypass caps as game changers.

    Your problem might come from slowly rising Vcc. Wait a little, power the LCD via digital I/O with sharp rise, or transistor.

    What are the PIC model numbers?
     
  3. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    Do you have a pull up resistor on MCLR? Not having one will cause your PIC to reset. I know the pickit will bring MCLR/Vpp high, removing the pickit without that resistor would cause what I think you are experiencing...
     
    tracecom likes this.
  4. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,395
    1,607
    QFT... I've been there myself.
     
    tracecom likes this.
  5. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,016
    can you be more clear please? Does the erratic behavior occur only immedialy after disconnect? Or does it continue to occur after the circuit has been disconnected?

    I have never put a pullup resistor on MCLR and have never had a problem. I was not even aware they were recommended. The demo board that I have from microchip does not seem to show one in the schematic.

    I would suggest that tracecomm poat a schematic, including the schematic of the power supply being used if any (ie not a battery).
     
  6. tracecom

    Thread Starter AAC Fanatic!

    Apr 16, 2010
    3,871
    1,394
    Ding! Ding! Ding! We have a winner. :D

    Seriously, I put a 10k to Vcc and the problem is apparently resolved.

    Thanks.
     
  7. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    You've probably been disabling MCLR in you configuration bits, since tracecomm just started with PICs, he probably didn't do it. I know I didn't like messing with those configuration bits when I first started, one bit can brick your device! :eek:
     
  8. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,016
    Ah yes! That is what I do since I rarely use MCLR. If I do I have a switch and a pull up.
     
  9. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    yup, that's how it's done! I have done this too many times to not suspect it up front... glad it works!
     
  10. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,016
    Or you could just disable MCLR in your config bits. It is not hard to do.
     
  11. tracecom

    Thread Starter AAC Fanatic!

    Apr 16, 2010
    3,871
    1,394
    At this point, everything is hard for me. All kidding aside, I did look at the config word in the code and MCLR is on, but I know how to turn it off.

    The schematic is attached, but it's not much. (R2 was just added.) I had the serial LCD on pin 2. I didn't have any trouble with the 12F509, but I had also used a 12F675 in this same setup; I had problems with it, with a 16F84A in a different breadboard. Now, I realize the problem was following the code, not the hardware.

    Thanks to everyone.
     
  12. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,395
    1,607
    And if you do manage to disable MCLR you've also managed to disable in circuit debugging.

    When you disable in circuit debugging you've made in circuit debugging impossible to do.
     
  13. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,016
    Both mplabs have a wizard to help with the config settings.
     
  14. tracecom

    Thread Starter AAC Fanatic!

    Apr 16, 2010
    3,871
    1,394
    I was so confused by MPLAB 8 that I switched to Microcode Studio, which is much friendlier to the user and to PBP3. However, I may need to take another look at MPLAB for its added features. Thanks.
     
Loading...