Enabling weak internal pull up resistors on port B


Closed Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Jul 2010
    Posts
    10

    Default Enabling weak internal pull up resistors on port B

    I have some switches that I need to install on my system. I have 4 of them and I currently have them hooked to PortB.4-7. I understand that there are internal pull up resistors that can be enabled for this port. It's my understanding that they are disabled after a power on reset.

    Can someone tell me how to enable these resistors from PICBasic Pro?

    Thanks,

    Dave

  2. #2
    Join Date
    Jul 2010
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    I should have mentioned that I'm using a 16F876 PIC and it does have the internal resistors.

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


    Did you find this post helpful? Yes | No

    Default

    Setting your configs at the top of your program will ensure that the internal pull ups are always enabled from the beginning even when power is interrupted because that's where it will start anyways.
    I suppose if you enable the internal pull ups in a subroutine that is called after certain conditions, then yes, you can lose that setup until that condition is called again after a power reset.
    The bit has to be cleared per data sheet so: OPTION_REG.7=0
    Last edited by LinkMTech; - 27th July 2010 at 17:27. Reason: Command entry
    Louie

  4. #4
    Join Date
    Dec 2009
    Location
    Kalamazoo
    Posts
    42


    Did you find this post helpful? Yes | No

    Default

    datasheet says that they are controlled by OPTION_REG , bit 7 (RPBU). (pg. 45)

    same page indicates that on reset, this register value defaults to all bits being set, (1111 1111),

    so, hook up your switches, dont change nothin' and switch away
    NAG CON WIFE!
    WIFE VAR MOOD

  5. #5
    Join Date
    Jul 2010
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    Ok, So let's say for some reason the OPTION_REG is getting reset. What syntax do I use in PicBasic Pro to set it again?

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by dbodenheimer View Post
    ok, so let's say for some reason the option_reg is getting reset. What syntax do i use in picbasic pro to set it again?
    option_reg.7=0
    Louie

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


    Did you find this post helpful? Yes | No

    Default

    I've often found internal pull-ups troublesome and simply use small external resistors between 4.7K and 10K depending on the input device

  8. #8
    Join Date
    Oct 2010
    Posts
    27


    Did you find this post helpful? Yes | No

    Default

    In that thought process, it appears option_reg.7 = 0 sets all 4 port B pull ups on an 16F88. Can one of those pins then be used as a serial output? I don't see where you can set individual pins.......

  9. #9
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Plcguy View Post
    In that thought process, it appears option_reg.7 = 0 sets all 4 port B pull ups on an 16F88. Can one of those pins then be used as a serial output? I don't see where you can set individual pins.......
    On a 16f690, I do this to get the weak pullups working...

    Code:
    option_reg.7=0 ' Enable WPUs by individual pin 
    WPUB = %11110000  'enable weak pullups on RB7, RB6, RB5 & RB4
    It all works weally weakpullup-tastically (but disable any other PIC stuff that maybe sharing those ports...and make sure they're all set as inputs)
    Last edited by HankMcSpank; - 8th October 2010 at 16:06.

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