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?
Prop Info and Apps: http://www.rayslogic.com/

Comments

  • TubularTubular Posts: 3,830
    edited 2019-12-09 - 18:40:55
    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
  • 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...
    Prop Info and Apps: http://www.rayslogic.com/
  • evanhevanh Posts: 8,587
    edited 2019-12-09 - 18:46:55
    eg:
    		wrpin	##%010010<<8, #tpin	' 15 kiloOhm digital output
    		drvh	#tpin
    


    EDIT: Fix up forum formatting issue
    "Those who think we are powerless to do anything about the greenhouse effect forget about the 'White House effect,'" - George H.W. Bush, 1988.
  • jmgjmg Posts: 14,175
    edited 2019-12-09 - 19:43:51
    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.
  • 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
    
    "Those who think we are powerless to do anything about the greenhouse effect forget about the 'White House effect,'" - George H.W. Bush, 1988.
  • evanhevanh Posts: 8,587
    edited 2019-12-09 - 18:55:51
    jmg wrote: »
    evanh has done a table,
    Updated/maintained version here - https://forums.parallax.com/discussion/comment/1452036/#Comment_1452036

    "Those who think we are powerless to do anything about the greenhouse effect forget about the 'White House effect,'" - George H.W. Bush, 1988.
Sign In or Register to comment.