PIC12f683 GPIO.0 Trouble


+ Reply to Thread
Results 1 to 12 of 12
  1. #1
    Join Date
    Dec 2012
    Location
    Georgia, USA
    Posts
    18

    Default PIC12f683 GPIO.0 Trouble

    Trying to build small power reset circuit using a PIC12f683.
    When GPIO.1 goes high, I set GPIO.0 high to MPS2222
    Transistor to make the circuit. Trouble is GPIO.0
    dosen't go low, or if it does it's only for a MS, then goes high again.
    and PIC12F683 starts to get hot.

    Code:
    '************************************************* ***************
    '* Name : RelayHold.BAS *
    '* Description : Pull Relay and Hold 15 seconds *
    '************************************************* ***************



    PRELAY Var GPIO.0 'Pull Relay turn off power to old controller 15 seconds
    RESETME Var GPIO.1 'GPIO.1 to Wait For 1 to Go High From Old Controller
    STAT Var GPIO.4 'Alias GPIO.4 to Turn on LED while relay is on


    ANSEL = 0 'Set all digital

    CMCON0 = 7 'Analog comparators off
    TRISIO =101110 'Set Pin I or O

    low STAT
    low PRELAY


    mainloop:

    If RESETME = 1 Then 'PIC Requesting Reset
    gosub ReSet_Ctrllr
    Endif
    Goto mainloop ' Do it forever

    End

    ReSet_Ctrllr:

    High PRELAY 'Turn on Relay connected to GPIO.0 to power cycle old controller
    High STAT 'Turn On LED If Present
    PAUSE 15000 'Hold Relay High for 15 seconds
    low PRELAY 'Turn Off Relay connected to GPIO.0
    low STAT 'Turn Off LED If Present
    PAUSE 50000 '50000 ' Give Old Controller Chance to Recover Pause about a minute

    return

    See attached drawing for details.

    Thanks in advanced,

    Larryd
    Attached Images Attached Images  

  2. #2
    Join Date
    Dec 2010
    Posts
    400

    Default Re: PIC12f683 GPIO.0 Trouble

    Your problem description sounds like the transistor is in backwards. A word of caution about 2222A pin order - MPS2222A is EBC but 2N2222A is CBE.
    Last edited by Charlie; - 9th February 2014 at 16:19.

  3. #3

    Default Re: PIC12f683 GPIO.0 Trouble

    At a quick glance I think your circuit has some GOTCHAS in it.

    You can supply a HI to the transistor, but you cannot send a LO to it, (diode blocking it) so the transistor base is floating.

    Unsure as to your reason for feeding your ground through a diode.

    You have no decoupling or smoothing caps in the 5V line

    Also think that your 10K pull down should be on the other side of the diode as when the controller reset is LO the pic is not able to see it as it will not pass through the diode.

  4. #4
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305

    Default Re: PIC12f683 GPIO.0 Trouble

    Well the biggest issue I see is GPIO.3 MCLR needs to be pulled high unless you disable it in your configs.

    I agree with previous about diodes. Remove them especially on the power pins and add the decoupling caps. They are not really necessary in light of the slow speed of your program.

    If PIC is getting hot it's sinking/sourcing too much current. Usually to the base of the transistor you'd use a 10K but if you look at datasheet of 2222A you can calculate the right size to get the transistor to saturation. Diodes to transistor isn't necessary and should be removed.

    Resistor to GPIO.1 should be at pin to pull pin low when circuit is not setting it high. You can ditch the diode there also.

    Since you're doing all that shifting I'd suggest you not use GPIO.0 and GPIO.1. They are the ICSP pins and with out a switch to isolate circuit use of those pins as shown will not allow you to do ICSP. Don't forget GPIO.3 is an input only when configured properly and your controller reset input is the best use of that pin.

    I suspect it will work as drawn once you fix the MCLR pin and transistor orientation if incorrect.
    Last edited by AvionicsMaster1; - 9th February 2014 at 19:30. Reason: oopse

  5. #5
    Join Date
    Dec 2012
    Location
    Georgia, USA
    Posts
    18

    Default Re: PIC12f683 GPIO.0 Trouble

    Thank you all for the Help !!
    I'm new to micro controllers and have another question about the
    decoupling capacitor. is this like a 0.1uf ceramic capacitor across pin
    1 and 8?

    Also does the diode on pin 1 of the 12F83 need to be removed?


    I'm working on now, will let you know the outcome in just a few.

    Thanks again !!

    Larryd

  6. #6
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305

    Default Re: PIC12f683 GPIO.0 Trouble

    Decoupling cap is across pins 1 and 8 and according to the "friendly" data sheet:To ensure these oscillator frequency tolerances, VDD and VSS must be capacitively decoupled as close to the
    device as possible. 0.1 μF and 0.01 μF values in parallel are recommended.

    Diode on pin 1, I think, needs to go. If you want to put it in series with the 10kish resistor pulling pin 4 high that would be fine. It is used to protect the power supply from the programming voltage applied to GPIO.3 during ICSP. If you're not going with ICSP you don't need the diode. Just the 10kish pulling GPIO.3 high.

  7. #7
    Join Date
    Dec 2012
    Location
    Georgia, USA
    Posts
    18

    Default Re: PIC12f683 GPIO.0 Trouble

    It works now but 12F683 still gets hot, I also noticed it flashes the
    power power light on the old controller after 15 seconds.
    but relay is still up seems like it takes 2 cycles to release relay.
    Then 12F683 starts getting really hot.

    I put the 10K resistor in not really sure on how to do the math on the
    transistor.

    any ideas?



    Thanks
    Larryd



    '************************************************* ***************
    '* Name : RelayHold.BAS *
    '* Target PIC : PIC12F683 *
    '* Oscillator : 4MHz internal *
    '* Description : Pull Relay and Hold 15 seconds *
    '************************************************* ***************


    RstRELAY Var GPIO.2 ' Alias GPIO.2 Go High To Pull Relay
    RESETME Var GPIO.4 ' Alias GPIO.4 to Wait For Pin-3 to Go High From Old Controller
    STAT Var GPIO.5 ' Alias GPIO.5 Go High show LED Relay Active



    ANSEL = 0 ' Set all digital
    CMCON0 = 7 ' Analog comparators off
    TRISIO =%00011000

    low STAT
    low RstRELAY


    mainloop:

    If RESETME = 1 Then ' PIC Requesting Reset
    gosub ReSet_Ctrllr
    Endif
    Goto mainloop ' Do it forever

    End

    ReSet_Ctrllr:

    High RstRELAY ' Turn on Relay connected to GPIO.0
    High STAT ' Turn On LED If Present
    PAUSE 15000 ' Hold Relay High for 15 seconds
    low RstRELAY ' Turn Off Relay connected to GPIO.0
    low STAT ' Turn Off LED If Present
    PAUSE 20000 '50000 'Give Controller Chance to Recover Pause about a minute


    return
    Attached Images Attached Images  

  8. #8
    Join Date
    Dec 2012
    Location
    Georgia, USA
    Posts
    18

    Default Re: PIC12f683 GPIO.0 Trouble

    Charlie,
    when I turn the transistor around it will not work at all

    Thanks
    Larryd
    Attached Images Attached Images  

  9. #9
    Join Date
    Nov 2007
    Location
    West Covina, CA
    Posts
    219

    Default Re: PIC12f683 GPIO.0 Trouble

    Any chance the controller reset pin voltage to the PIC coming in at greater than 5V?
    Louie

  10. #10
    Join Date
    Dec 2012
    Location
    Georgia, USA
    Posts
    18

    Default Re: PIC12f683 GPIO.0 Trouble

    Louie,
    I just tested, it is 4.88 V.

    Also don't know if this helps but once the 12F683 goes into the over heating mode,
    I removed connections on pins 2 - 7 and it still got hotter till I disconnected power.

    Thanks
    Larryd

  11. #11
    Join Date
    Dec 2010
    Posts
    400

    Default Re: PIC12f683 GPIO.0 Trouble

    Is your 5V supply really 5V? Does it stay at 5V when the relay is activated / not activated?

  12. #12
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333

    Default Re: PIC12f683 GPIO.0 Trouble

    Quote Originally Posted by Larryd View Post
    Louie,
    I just tested, it is 4.88 V.

    Also don't know if this helps but once the 12F683 goes into the over heating mode,
    I removed connections on pins 2 - 7 and it still got hotter till I disconnected power.

    Thanks
    Larryd
    Sounds like you have blown up the chip. Check what voltage is being fed into GPIO.4.

Similar Threads

  1. 12F683: I change GPIO.5 but GPIO.0 also changes...why?
    By chicowoodhill in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 4th December 2012, 18:09
  2. Replies: 1
    Last Post: - 29th February 2012, 10:37
  3. Trouble with PIC12F683 - GP0 GP1 as inputs
    By erice1984 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 30th March 2009, 05:32
  4. pic12F683 , gpio.5 not accessible...
    By flipper_md in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 9th May 2008, 06:25
  5. Using the pic12F683
    By TonyA in forum General
    Replies: 2
    Last Post: - 6th April 2006, 13:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts