Shop OBEX P1 Docs P2 Docs Learn Events
How to activate internal pull-up on a pin? — Parallax Forums

How to activate internal pull-up on a pin?

You can do this right?
Seems the USB mode does this automatically?

But, how to do this for regular pin I/O?

Comments

  • TubularTubular Posts: 4,702
    edited 2019-12-09 18:40
    The trick is to set it as an output with whatever resistor using WRPIN

    You can still read the true input state back using the IN bit, despite it being an output
  • RaymanRayman Posts: 14,646
    Eeek…

    Thanks, I think I see this now.
    Was hoping for a simpler fix converting P1 I2C code to P2.
    Going to be more difficult that I thought...
  • evanhevanh Posts: 15,916
    edited 2019-12-09 18:46
    eg:
    		wrpin	##%010010<<8, #tpin	' 15 kiloOhm digital output
    		drvh	#tpin
    


    EDIT: Fix up forum formatting issue
  • jmgjmg Posts: 15,173
    edited 2019-12-09 19:43
    Rayman wrote: »
    You can do this right?
    Seems the USB mode does this automatically?

    But, how to do this for regular pin I/O?

    evanh has done a table,
    https://forums.parallax.com/discussion/comment/1452036/#Comment_1452036
    may not be the latest version ? updated from below.


    There are many light-drive choices, so pick one and drive the output to give the HI or LOW pull direction.
  • evanhevanh Posts: 15,916
    If you want strong low-side output drive, like an open collector arrangement, then can have high level as 15kR and low level as full strength.
    		wrpin	##%010000<<8, #tpin	' 15 kiloOhm high and full low digital output
    		drvh	#tpin
    
  • evanhevanh Posts: 15,916
    edited 2019-12-09 18:55
    jmg wrote: »
    evanh has done a table,
    Updated/maintained version here - https://forums.parallax.com/discussion/comment/1452036/#Comment_1452036

Sign In or Register to comment.