• AVR Freaks

Hot!PIC16F18313 WUPA

Author
buddacedcc
Super Member
  • Total Posts : 209
  • Reward points : 0
  • Joined: 2009/02/01 15:39:06
  • Location: Italy
  • Status: offline
2021/01/28 11:52:46 (permalink)
0

PIC16F18313 WUPA

Very stupid question...I'm became crazy
I would like enable PULL-UP in port RA5...but don't work. I read same times data sheet but without solution.
I try to disconnect the pin and measure with scope voltage but it is always 0. Any idea to find my mistake ?
 

TRISA = 0x3F;
PORTA = 0x00;
ANSELA = 0x00;
WPUA = 0x3F;
ODCONA = 0x00;
SLRCONA = 0x00;
INLVLA = 0x00;

#1

5 Replies Related Threads

    ric
    Super Member
    • Total Posts : 30273
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: PIC16F18313 WUPA 2021/01/28 12:14:02 (permalink)
    0
    You missed this comment below the description of the WPUA register:

    When configured as open-drain, the pull-up is enabled when the output value is high,
    and disabled when the output value is low.


    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #2
    buddacedcc
    Super Member
    • Total Posts : 209
    • Reward points : 0
    • Joined: 2009/02/01 15:39:06
    • Location: Italy
    • Status: offline
    Re: PIC16F18313 WUPA 2021/01/28 15:27:58 (permalink)
    0
    ric
    You missed this comment below the description of the WPUA register:

    When configured as open-drain, the pull-up is enabled when the output value is high,
    and disabled when the output value is low.



    I'm sorry don't understand. I'm not using opendrain configuration according to datasheet ODCONA = 0x00 and Iìm using as Input TRISA = 0x3F (TRISA5 = 1)
    post edited by buddacedcc - 2021/01/28 15:30:25
    #3
    ric
    Super Member
    • Total Posts : 30273
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: PIC16F18313 WUPA 2021/01/28 15:44:54 (permalink)
    +1 (1)
    Oops sorry, I misread that you were turning the open drain on.
    The datasheet implies the latch value shouldn't matter if the ODCON bit is clear, but try writing 0x3F to either PORTA or LATA (doesn't matter which, to see if that makes a difference.
     
    Do make sure there is nothing but the scope connected to the pin. The pullup current is only a few tens of microamps.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #4
    buddacedcc
    Super Member
    • Total Posts : 209
    • Reward points : 0
    • Joined: 2009/02/01 15:39:06
    • Location: Italy
    • Status: offline
    Re: PIC16F18313 WUPA 2021/01/28 15:47:01 (permalink)
    +2 (2)
    Solved, f**k MCC!!
    #pragma config FEXTOSC = ECH    // FEXTOSC External Oscillator mode Selection bits (EC (external clock) above 8 MHz)


    #5
    ric
    Super Member
    • Total Posts : 30273
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: PIC16F18313 WUPA 2021/01/28 16:16:58 (permalink)
    +1 (1)
    Well spotted.
    Now you know why we prefer to see complete test code, not just the snippet you think contains the error.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #6
    Jump to:
    © 2021 APG vNext Commercial Version 4.5