12F683 internal pull up


Closed Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2007
    Posts
    19

    Default 12F683 internal pull up

    Seems that internal pull up resistors not working?

    Simple code to work with. I am using GPIO.5 as input as digital. The LED still blinks from GPIO.2. The internal pull up dont work as expected to keep input low. Am I missing something?

    CODE:
    Include "bs2defs.bas"
    @ DEVICE PIC12F683,MCLR_OFF,INTRC_OSC_NOCLKOUT,WDT_OFF,BOD_ ON, PWRT_ON


    A var word
    OSCCON = %01100000 ' Internal 4MHz osc
    ADCON0 = 0 ' A/D off
    CMCON0 = 7 ' Comparators off
    ANSEL = 0 ' Set all digital
    WPU = %00110111 '0 ' Internal pull-ups = off ISSUE?????? Register 4.3
    OPTION_REG.7=0 'Enable internal pull-ups
    TRISIO = %100000 'set GPIO.5 as input, rest output
    test var GPIO.5 'Input

    START:

    LOW 2
    PAUSE 100

    if test = 1 then high 2:PAUSE 1000


    goto START

    The LED still flashes. it should not be flashing unless input is triggered from +5 volt.

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    The internal pull up is a weak internal pull up, easy to over ride it with almost any external drive (parameter D070 in the datasheet), only about 250uA of current for pullup.

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


    Did you find this post helpful? Yes | No

    Default

    If you have internal pull-ups ON, and you're testing the input pin for logic 1, the only
    way your LED shoud NOT blink would be when GPIO.5 is pulled to ground.
    Regards,

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

  4. #4
    Join Date
    Sep 2007
    Posts
    19


    Did you find this post helpful? Yes | No

    Thumbs up Works

    Got it working, added INTCON=7. changed input to PULSIN. Everyting is working well.

    OOPS should be INTCON=0 not INTCON=7.

  5. #5
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by hvacrtech View Post
    Got it working, added INTCON=7. changed input to PULSIN. Everyting is working well.
    OOPS should be INTCON=0 not INTCON=7.
    I'm not seeing where the INTCON or the PULSIN statements should make a difference...
    And if you look back at your first post:
    Simple code to work with. I am using GPIO.5 as input as digital. The LED still blinks from GPIO.2. The internal pull up dont work as expected to keep input low. Am I missing something?
    Why would the internal pull UP work as expected to keep the input LOW?

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


    Did you find this post helpful? Yes | No

    Default

    OOPS should be INTCON=0 not INTCON=7.
    Err, OK, but INTCON is already zero, by default, at power-up. Not sure where PULSIN fits into the grand scheme, but at least you got it working...;o}
    Regards,

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

  7. #7
    Join Date
    Sep 2007
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    If you have internal pull-ups ON, and you're testing the input pin for logic 1, the only
    way your LED shoud NOT blink would be when GPIO.5 is pulled to ground.

    That way it been erratic behavior and You are right about that the led should not blink when GPIO.5 is opened. that way when I opened the path from ground, the led still blinks. After I added INTCON=0 to it, it behaves much better and dont blink when opened. When I closed the GPIO.5 to ground, the led did blink.

    I dont know why but added INTCON=0, system stablizes. Like other PIC I know dont have issues with out this configuration. Maybe it a requirement?
    Last edited by hvacrtech; - 26th July 2008 at 19:26.

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


    Did you find this post helpful? Yes | No

    Default

    Clearing INTCON should not be necessary unless you had previously placed some value
    in it you need to clear. At power on INTCON by default is already clear.

    If it wasn't you could really have some odd behaviour with unexpected interrupts firing.
    Regards,

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

Similar Threads

  1. Internal vs. external osc for comms
    By mtripoli in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th January 2010, 14:58
  2. 16F688 Internal clock and MCLR
    By manxman in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 18th August 2007, 18:38
  3. 16f677a to 12f683
    By ChrisHelvey in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 25th July 2007, 06:16
  4. Use internal program memory like DATA memory
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th December 2006, 18:38
  5. PIC12F675, accuracy of baud rate with Internal Oscillator
    By Chris Mayhew in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 31st August 2005, 22:41

Members who have read this thread : 1

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