+ Reply to Thread
Results 1 to 14 of 14
  1. #1
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    224

    Default Pullup Configuration Help

    Hi All

    Been a whilst since I played with this stuff !

    Code:
     ' Name       : WhiteLightClock.pbp
    ' Compiler    : PICBASIC PRO Compiler 2.6
    ' Assembler   : MPASM
    ' Target PIC  : PIC16F627A
    ' Hardware    : ProtoType
    ' Oscillator  : 4 Megs Internal
    ' Keywords    : I2CREAD, I2CWRITE
    ' Description : White Light on and off
    ' using the Dallas DS1307 I2C RTC.
                
                
                PORTB.6=0   'Led off
                TRISA=0     'Port A all outputs
                TRISB.3=1   'Make RB3 input
                'OPTION_REG.7=0 'Enable internal pull-ups
                CMCON=7
                
    
    ' Alias pins
                SDA Var PORTB.1
                SCL Var PORTB.2
                Led var PORTB.6 'White Light
                Pir Var PORTB.3 ' Input Button
    Above is all good and working except for the internal pullups.....I cannot get them to work.... Commenting the OPTION line out and putting a 10k resistor in place all is ok.

    I suspect it is the order that the configuration is in....PORTA, PORTB, TRIS, OPTION, CMCON etc.

    Any advice to the right order for above here welcome !

    Thank You for reading

    BR

    Andy

  2. #2
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,157

    Default Re: Pullup Configuration Help

    Hi Andy,

    I think you have already posted something similar in another thread, and I think you already solved your problem.
    Why did you post a new one?
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  3. #3
    Join Date
    May 2013
    Location
    australia
    Posts
    1,496

    Default Re: Pullup Configuration Help

    Richard, I accidentally deleted your post; sorry, I will try to get it back.
    Last edited by sayzer; - 31st October 2018 at 07:12.
    This is more entertaining than Free to Air TV

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    1,496

    Default Re: Pullup Configuration Help

    Richard, I accidentally deleted your post; sorry, I will try to get it back.
    don't worry repost of code to disprove another myth
    I suspect it is the order that the configuration is in....PORTA, PORTB, TRIS, OPTION, CMCON etc.
    wpu works as long as registers are set properly , order is not important

    Code:
    #CONFIG
    cfg = _INTOSC_OSC_NOCLKOUT
    cfg&= _WDT_ON
    cfg&= _PWRTE_OFF
    cfg&= _MCLRE_ON
    cfg&= _BODEN_ON
    cfg&= _LVP_OFF
    cfg&= DATA_CP_OFF
    cfg&= _CP_OFF
      __CONFIG cfg#ENDCONFIG
    
    cnt var byte
    
    led var porta.7
    
    mainloop: 
    
        cnt=10
        trisb.3=1
        high led
        while cnt
            cnt=cnt-1      
            OPTION_REG.7=1     
            pause 50
            OPTION_REG.7=0 
            pause 50
        wend   
        low led
      
        OPTION_REG.7=0
        cnt=10
        while cnt
            cnt=cnt-1 
            trisb.3=0    
            pause 50
            trisb.3=1 
            pause 50
        wend 
     GOTO mainloop        ' Do it forever and ever and ever
    This is more entertaining than Free to Air TV

  5. #5
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    224

    Default Re: Pullup Configuration Help

    Thank you all

    I did ask similar previously... Still dont get why I am having issues... Clutching at straws a little.

    Just looking for help !

    Hardware engineer in a software world..... Hardware works so really dont get why the S/W pullups dont

    Thank you for listening

    BR
    Andy

  6. #6
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,157

    Default Re: Pullup Configuration Help

    Quote Originally Posted by richard View Post
    .
    wpu works as long as registers are set properly , order is not important

    TRIS bit must be set before WPU.
    Individual WPU circuit is disabled once (IF) the port pin is set to be output.

    IF you change the TRIS bit to be "output" somewhere in the code later, then WPU is disabled for that pin; Thus, you first need to set the tris bit again and then WPU bit.

    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  7. #7

    Default Re: Pullup Configuration Help

    Thus, you first need to set the tris bit again and then WPU bit
    That's not correct.

    If the WPU bit is set, it remains set.

    If you set the pin as an output then the weak pullup is disabled, but the WPU bit doesn't change.
    If you then set the pin as an input the weak pullup turns back on automatically.

    The order doesn't matter.

  8. #8
    Join Date
    May 2013
    Location
    australia
    Posts
    1,496

    Default Re: Pullup Configuration Help

    I did ask similar previously... Still dont get why I am having issues... Clutching at straws a little.

    Just looking for help !
    did you try my code , at least it will prove the wpu on that pin is not damaged.


    there is one more setting that can affect b.3 wpu for that chip family , since you only show snippets of code I would only
    be guessing if thats the problem .
    a complete pgm that demonstrates the problem would get better results
    This is more entertaining than Free to Air TV

  9. #9
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    224

    Default Re: Pullup Configuration Help

    Hi Richard

    Yes.... Your code works fine :-)

    Something I am doing at my end. Thank you for listening

    Can post more tomorrow .... Working away at moment :-)

    BR
    Andy

  10. #10
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    224

    Default Re: Pullup Configuration Help

    Well... I still dont know what i was doing wrong.

    With the inclusion of a 10K resistor all is working..... Cannot get internal pullups to work at all. I give up ;-)

    Thank you all for your help.... Good to know you are there.

    BR
    Andy

  11. #11
    Join Date
    May 2013
    Location
    australia
    Posts
    1,496

    Default Re: Pullup Configuration Help

    Well... I still dont know what i was doing wrong.
    if you ignore the myths often propagated on forum, wpu is as simple as pie .
    don't forget its weak pullup @200uA its pretty easy to drag it below the logic high threshold level ,my saleaa logic drags it down and
    gives false reading

    Cannot get internal pullups to work at all. I give up ;-)
    got nothing to work with. I give up too
    Attached Images Attached Images  
    This is more entertaining than Free to Air TV

  12. #12
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    224

    Default Re: Pullup Configuration Help

    Hi Richard

    It was only a switch ..... Still is, so no leakage either hard down to 0v when on or using the pull up to 5v.

    5v is good clean linear battery derived from 12v Cell .... No noise, 0.1mfd decoupled supply.

    I really think it should work..... but extra 2p for a 10k resistor won't break the bank LoL

    Really appreciate the help / advice

    BR Andy

  13. #13
    Join Date
    May 2013
    Location
    australia
    Posts
    1,496

    Default Re: Pullup Configuration Help

    i'm sure i'm not the only one curious to observe the hitherto unknown method of disrupting wpu that you seem to have discovered
    This is more entertaining than Free to Air TV

  14. #14
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    224

    Default Re: Pullup Configuration Help

    Will experiment more when the decks are clear

    Andy

Similar Threads

  1. Weak pullup on 18f2620
    By Alberto in forum PBP3
    Replies: 2
    Last Post: - 14th October 2016, 12:00
  2. Pullup confusion 12c508a
    By Michael in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 10th September 2016, 18:52
  3. Replies: 6
    Last Post: - 29th December 2011, 22:39
  4. pullup and pulldown resistor help
    By studysession in forum General
    Replies: 5
    Last Post: - 29th January 2009, 03:46
  5. button pullup/down resistor?
    By davewanna in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 19th June 2008, 05:13

Members who have read this thread : 24

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

Tags for this Thread

Posting Permissions

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