12C671 - GP3 problem


Closed Thread
Results 1 to 37 of 37
  1. #1

    Exclamation 12C671 - GP3 problem

    Hi, I am having problems with GP3 of my 12C671. I am trying to use it as an input along with others (GP0,1,2,...,4). MCLR is off. All are held high with 10K, but pressing GP3 low, does not result in PIC performing accordingly.
    Any ideas please as how I can use this pin properly? Thanks
    ___________________
    WHY things get boring when they work just fine?

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Does your config look something like this?
    Code:
    __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _CP_OFF
    Dave
    Always wear safety glasses while programming.

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    Does your config look something like this?
    Code:
    __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _CP_OFF
    It is:
    __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_ALL
    ___________________
    WHY things get boring when they work just fine?

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Wink

    Hi, Finance

    could we see your config and declare stubb ???

    better, whole PBP program if possible ?

    Many, many reasons possible .... and crystal ball saturated.

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5


    Did you find this post helpful? Yes | No

    Default

    DEFINE NO_CLRWDT
    DEFINE OSC 4
    Define OSCCAL_1K 1
    @ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_ALL
    '// For PIC12C671
    include "modedefs.bas"

    '// Define variables
    ToTx VAR GPIO.0
    PAUSE 30
    '// OSCCAL=0
    TRISIO = %111110
    OPTION_REG = %10000000
    ToTx = 0
    INTCON=0
    ADCON0.0=0
    ADCON1=7

    send:
    if gpio.1=0 then
    serout ToTx,N2400,["G0"]
    Low ToTx
    pause 10
    endif

    if gpio.2=0 then
    serout ToTx,N2400,["G1"]
    Low ToTx
    pause 10
    endif

    if gpio.3=0 then
    serout ToTx,N2400,["G3"]
    Low ToTx
    pause 10
    endif

    if gpio.4=0 then
    serout ToTx,N2400,["G5"]
    Low ToTx
    pause 10
    endif

    goto send
    end
    ___________________
    WHY things get boring when they work just fine?

  6. #6
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Question

    re,

    1) did you try a simple pin test ??? just to verify pin is still alive ???

    2) did you verify your 10k is Ok ??? ( logic 1 on pin when nothing done )

    Also, Did you try enabling the CLR Watchdog ??? ...

    Do all '671 react like this ???

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  7. #7


    Did you find this post helpful? Yes | No

    Question

    Hi, for some reason when I check the voltage on all pins, every pin except GP3 has 5V, whereas I don't know why GP3 is showing only 0.5V. They all are held high (5V) with 10K.

    I also tried with 1K then 470Ohm, but voltage on GP3 is not going above 0.8V after that. Also just want to add that, my circuit is in such a way that it only gets power when a button is pressed. Buttons bring in the -Ve supply to the system from a 12V battery, also the -Ve goes to the 7805 so PIC gets its 5V as well.
    Last edited by financecatalyst; - 17th March 2010 at 12:00.
    ___________________
    WHY things get boring when they work just fine?

  8. #8
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Unhappy Too bad

    Quote Originally Posted by financecatalyst View Post
    Hi, for some reason when I check the voltage on all pins, every pin except GP3 has 5V, whereas I don't know why GP3 is showing only 0.5V. They all are held high (5V) with 10K.

    .
    That looks much like a fried pin ... as it is an " input only " pin ...
    You have to take care of these pins ... cause there's no clamping diode to VDD : must be treated as a full CMOS input with antistatic discharges handling precautions.

    Alain
    Last edited by Acetronics2; - 17th March 2010 at 12:45.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  9. #9


    Did you find this post helpful? Yes | No

    Default Update

    Hi, I now got a chance to come back to this problem of my pic. Apologies for the delay in updating you.
    OK, I have programmed another 12C671 taking care of static discharges. Now the voltage part on GP3 is working fine. It is pulled high at 5V. But making it low does not initiate the required serout signal.
    Is there something I am missing in the code to make proper use of GP3 as an input?
    Thanks
    ___________________
    WHY things get boring when they work just fine?

  10. #10


    Did you find this post helpful? Yes | No

    Question Anyone?

    Anyone there?
    Please help
    ___________________
    WHY things get boring when they work just fine?

  11. #11
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I never responded because I do not see where the problem is.

    Have you changed the code or configs any? If you did re-post.
    Did you try clearing the WDT like Alan suggested?

    Can you post a schematic or a picture of your setup?
    Dave
    Always wear safety glasses while programming.

  12. #12


    Did you find this post helpful? Yes | No

    Question Update

    Hi, thanks for the reply.
    I did changed the config and enabled the WDT. The code looks like this now:
    Code:
    DEFINE OSC 4
    Define OSCCAL_1K 1
    @ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _CP_ALL
    '// For PIC12C671
    include "modedefs.bas"
    
    '// Define variables
    ToTx VAR GPIO.0
    PAUSE 30 
    '// OSCCAL=0
    TRISIO = %111110 
    OPTION_REG = %10001000
    ToTx = 0 
    INTCON=0 
    ADCON0.0=0
    ADCON1=7
    
    send:
    if gpio.1=0 then
    serout ToTx,N2400,["G0"]
    Low ToTx
    pause 10
    endif
    
    if gpio.2=0 then
    serout ToTx,N2400,["G1"]
    Low ToTx
    pause 10
    endif
    
    if gpio.3=0 then
    serout ToTx,N2400,["G3"]
    Low ToTx
    pause 10
    endif
    
    if gpio.4=0 then
    serout ToTx,N2400,["G4"]
    Low ToTx
    pause 10
    endif
    
    goto send
    end
    My circuit only gets power when any button is pressed. I can try to scan the paper after drawing the circuit or try to find a software over the net if you think the circuit could be the culprit.
    But I would like to add that rest all the buttons are working fine, so I believe the circuit is ok, GP3 is connected the same way as all other pins. Even the voltage on that pin behaves the same way as on any other pin under same circumstances but no DATA OUTPUT is there.
    ___________________
    WHY things get boring when they work just fine?

  13. #13
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Can you try making GPIO3 active high?
    Dave
    Always wear safety glasses while programming.

  14. #14


    Did you find this post helpful? Yes | No

    Default

    Yes I can do it to check but I really need to find an answer to make it work Active Low. I will reply with an update with Active High.
    ___________________
    WHY things get boring when they work just fine?

  15. #15


    Did you find this post helpful? Yes | No

    Question

    I tried one method in which I gave continues supply to the PIC for 5v. All pins work fine as expected (Active Low).
    The problem of GP3 only strikes when circuit gets power only when button is pressed and pin is made low.
    ___________________
    WHY things get boring when they work just fine?

  16. #16
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Not sure about the 12C chip, but on 12F series GPIO3 is the MCLR pin and what could be happening is by grounding this you are resetting the PIC - there is a way of disabling the reset function on the 12F series, so you might need to do the same on the 12C chip

  17. #17


    Did you find this post helpful? Yes | No

    Question

    Quote Originally Posted by malc-c View Post
    Not sure about the 12C chip, but on 12F series GPIO3 is the MCLR pin and what could be happening is by grounding this you are resetting the PIC - there is a way of disabling the reset function on the 12F series, so you might need to do the same on the 12C chip
    Hi, I already have disabled the MCLR - (in Config). I also mentioned in the post above that PIC works fine when 5V supply is continues. Thanks
    ___________________
    WHY things get boring when they work just fine?

  18. #18
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    PIC works fine when 5V supply is continues.
    What exactly do you mean?
    Dave
    Always wear safety glasses while programming.

  19. #19


    Did you find this post helpful? Yes | No

    Question

    When I put 5V continues supply i.e. system already gets +ve & -Ve 5V and does not depend on button press for -Ve. Then lowering GP3 does result in serout data.

    In other words, pic gets its 5V continues and all pins pulled high with 10K. Lowering any pin results in serout data.
    ___________________
    WHY things get boring when they work just fine?

  20. #20
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by financecatalyst View Post
    i.e. system already gets +ve & -Ve 5V and does not depend on button press for -Ve.
    Are you applying 10V across the supply pins ? - I thought most pics will only work on 5V (ie +5v and 0V supply lines)

  21. #21


    Did you find this post helpful? Yes | No

    Default

    No, it is 5V only. i.e. +5V & 0V.
    ___________________
    WHY things get boring when they work just fine?

  22. #22
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Wink We want the complete truth !!!

    Hi, FC

    My circuit only gets power when any button is pressed.
    Reading that , ... I think you didn't show or tell us everything :

    OR the code shown only is a part of ...

    OR you should show the Hardware side ...

    no way for us to help further not knowing what you did and how you did it ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  23. #23


    Did you find this post helpful? Yes | No

    Question

    Hi, I have attached the schematic and this is the complete code I have shown here. Hope to find a solution soon.
    Attached Images Attached Images
    ___________________
    WHY things get boring when they work just fine?

  24. #24
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    The way I read this, from the data sheet
    Most other registers are reset to a “reset
    state” on Power-on Reset (POR), MCLR Reset, WDT
    Reset, and MCLR Reset during SLEEP
    Every time you press the GPIO.3 button the chip will go into a continuous reset.
    The chip never gets to read the configuration to see that MCLR is turned off.
    Dave
    Always wear safety glasses while programming.

  25. #25
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by financecatalyst View Post
    Hi, I have attached the schematic
    Comments:

    1) - There are no smoothing capacitors either side of the regulator - what are you using to provide the 12v supply. If it's simply a bridge rectifier off a transformer then the supply will need smootthing.

    2) - I assume the diodes are LEDS ? If so then you would be better off putting them in series with the resistors rather than in parallel.

    3) - If they are not LEDS, then try removing them from the circuit, there may be some reverse bias or something causing the current to flow and possibly short out the supply ?

    As Dave has mentioned - It does sound as if you are constantly resetting the chip before it configures itself.

  26. #26
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    With reference to your schematic, I am sure you have mistaken in drawing it, while the hardware is correctly wired, otherwise you will short the 12 Volts as soon as you connect it to the circuit. ( see the snap posted and compare it with your circuit)

    As far as the code is concerned, I would place a delay below the label send


    Code:
    send:
    PAUSE 10
    if gpio.1=0 then
    serout ToTx,N2400,["G0"]
    Low ToTx
    pause 10
    endif

    Al.
    Attached Images Attached Images  
    All progress began with an idea

  27. #27
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by aratti View Post
    With reference to your schematic, I am sure you have mistaken in drawing it, while the hardware is correctly wired, otherwise you will short the 12 Volts as soon as you connect it to the circuit. ( see the snap posted and compare it with your circuit)
    how did I miss that ! I was just getting confused with all the diodes !

    Mind you I guess it was just a miss-print, otherwise there would of been a nice bang when he powered it up for the first time

  28. #28
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Have you tried this with _PWRTE_OFF..?
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  29. #29


    Did you find this post helpful? Yes | No

    Question

    Aratti, your eye for detail is good. I made mistake in drawing it. Thanks for correcting it. I tried with a pause of 50mS before going to label send, but it didn't worked.

    Malcom, Mackrackit, thanks for pointing out the smoothing capacitors and resetting problem.

    I tried the smoothing capacitors at in & out of 78L05. At one configuration of 47uF at input & 22uF at output, everything works fine with one particular 12V battery I have but does not work when I change the battery. That particular battery had a voltage of 12.96V, I changed it, the other battery had 12.16V. I tried many times with with 12.96V, it works fine all the time but not when I change the battery. I tried different values of capacitors and the results were very strange, at few other configurations of the capacitors, it even affected other pins as well. All these trial were done with 12.96V battery.

    After seeing these results, I believe the problem is related to correct configuration of capacitors. Any comments?

    I would like to ask two things:
    1) Is there any formula or way to find out the correct capacitor values at in & out of 78L05?

    2) Is there any way around the resetting problem of GP3, I would like to try it as well to see if that is the root cause of this problem?

    Bruce, thanks for the reply, I will try with _PWRTE_OFF and update this thread.

    Thanks everyone for trying to help.
    ___________________
    WHY things get boring when they work just fine?

  30. #30
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    1) Is there any formula or way to find out the correct capacitor values at in & out of 78L05?
    No! Simple rule of thumb. place 220 nF at the input and 100 nF at the output, the closest possible to the regulator terminal.

    Al.
    All progress began with an idea

  31. #31
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    If the _PWRTE_OFF idea does not work then I think you know the problem is in resetting as you mentioned if the chip has continuous power it works.

    So you could add something to the GPIO.3 button to power the chip first, before the actual button is pressed. No magic but more circuits.
    Dave
    Always wear safety glasses while programming.

  32. #32


    Did you find this post helpful? Yes | No

    Question Update

    I tried with 220nF at input & 100nF at output of 78L05. Changed the config a little to try this code on 12F635 which I happen to have quiet a lot. This way I can save few 12C671. The circuit remains the same.

    _PWRTE_ON or OFF is not making any difference.

    The problem is stuck on GP4 now. GP 0,1,2,3 are working fine.
    ___________________
    WHY things get boring when they work just fine?

  33. #33
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Hello F.C.
    What voltage do you read on GP.3 when the switch is pressed? I ask because it is an input with schmitt Trigger input, perhaps the voltage is not low enough to switch it.
    Last edited by Archangel; - 2nd April 2010 at 05:53.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  34. #34


    Did you find this post helpful? Yes | No

    Question

    Quote Originally Posted by Joe S. View Post
    Hello F.C.
    What voltage do you read on GP.3 when the switch is pressed? I ask because it is the only input with schmitt Trigger input, perhaps the voltage is not low enough to switch it.
    I read 0V when switch is pressed.
    ___________________
    WHY things get boring when they work just fine?

  35. #35
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    I would look for anything (registers) that sets different on POR as opposed to a cold boot, I have not looked, does this chip have ANSELH ? I just gotta hunch it is some little analog something . . .
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  36. #36


    Did you find this post helpful? Yes | No

    Question

    Quote Originally Posted by Joe S. View Post
    Does this chip have ANSELH ?
    No, I have checked the datasheet again for 12C671. Thanks
    ___________________
    WHY things get boring when they work just fine?

  37. #37
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    It seems strange that you stated it works fine with one battery but not another. Is there any reason for using 12v, which will mean the regulator will need to drop 7v which would generate a fair amount of heat. I would make a simple supply for testing of 6v transformer, rectifier, and a couple of 2500uF electrolytic capacitors (or use one of those DC plug type power supplies, and do away with the rectifier ), Then use the 100 / 200 nf caps either side of the regulator. It's also worth mounting the regulator on a heatsink. This should give you a very stable, smooth 5V dc supply for testing.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

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