PIC "internal weak pull up"

Discussion in 'Embedded Systems and Microcontrollers' started by KansaiRobot, Sep 16, 2015.

  1. KansaiRobot

    Thread Starter Active Member

    Jan 15, 2010
    318
    5
    In the datasheet of the PIC I am using it says
    "Each of the PORTB pins has a weak internal pull-up"

    What does this mean and imply??
     
  2. jayanthd

    Member

    Jul 4, 2015
    274
    29
    It means PORTB pins have internal pull up resistors.
     
  3. KansaiRobot

    Thread Starter Active Member

    Jan 15, 2010
    318
    5
    so I dont need to put my own pull up (or down) resistors when I am not using the pins???

    or in other words, what for are these resistors??

    and in that line, does that mean that I have to pull up or down the unused pins of other ports???

    How about the oscillator pins when I am not using them??
     
  4. nsaspook

    AAC Fanatic!

    Aug 27, 2009
    2,912
    2,177
    The internal pull up/down is for ease of interface with devices that don't provide full 0/1 logic levels like a switch or open collector encoder without using external parts. A open switch or off transistor is logic 1 and closed switch or on transistor is a logic 0 on the B port input pin with internal pull-up enabled.
     
  5. KansaiRobot

    Thread Starter Active Member

    Jan 15, 2010
    318
    5
    Is it possible to "pull up" and "pull down" at the same time???:eek:

    I do this strange question because here I am taking a look at a circuit, designed by someone else a couple of years ago and that got approved. It uses an Attiny2313 and I can clearly see in some of the pins (that are used by the way) that they are connected to 5V through a 4.7K resistor and also to ground through a similar resistor....

    How can this be possible? I am not sure but I think they are input pins btw...
     
  6. jayanthd

    Member

    Jul 4, 2015
    274
    29
    Pullups means pull ups. It doesn't work as pull downs. If they have used two resistors in a design to both pullup and pulldown then they have used them as voltage dividers maybe to interface 5V pin of AVR or PIC to a 3.3V input pin of other device. They have used it for voltage level translation.
     
    KansaiRobot likes this.
  7. dannyf

    Well-Known Member

    Sep 13, 2015
    1,828
    365
    Yes. Some newer mcus allow both (internal) pull-up and pull-down.

    So to detect if a device is attached to that pin. Some chips, like linear's oscillators, use that approach to program the frequency output.
     
  8. KansaiRobot

    Thread Starter Active Member

    Jan 15, 2010
    318
    5
    I am not using the OSC pins of my PIC. (I am using the internal oscilltor)

    What should I do with these unused pins???
     
  9. nsaspook

    AAC Fanatic!

    Aug 27, 2009
    2,912
    2,177
  10. KansaiRobot

    Thread Starter Active Member

    Jan 15, 2010
    318
    5
    Yes, apparently I can do that with OSC2 since this can act as RA5 too, but what about OSC1. This can not be set as an output....therefore what to do?
     
  11. nsaspook

    AAC Fanatic!

    Aug 27, 2009
    2,912
    2,177
    What chip? Usually there are configuration bits to set both to outputs if the internal oscillator block is used.
    Example for pic18F8722 :
    #pragma config OSC = INTIO67 // Oscillator Selection bits (Internal oscillator block, port function on RA6 and RA7)
     
    KansaiRobot likes this.
  12. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,606
    I have never seen a Microchip device where that is true. Check the data sheet again.
     
  13. dannyf

    Well-Known Member

    Sep 13, 2015
    1,828
    365
    Read the device datasheet.
     
  14. KansaiRobot

    Thread Starter Active Member

    Jan 15, 2010
    318
    5
    I kinda suspect why this is like that.

    I am using the PIC18F2550. This has USB capabilities and in the oscillator configurations there are several mode which gives selection to the PIC clock and to the USB clock. Even if I set the PIC to internal oscillator it is assumed that the "USB part" will be clocked by a external crystal. Therefore the existence of a external source is assumed, ergo OSC1 is assumed to be always needed.

    With other PICs I suppose you can select the whole IC to internal therefore OSC1 and OSC2 are not needed and can be set to input pins.

    My error is to be using this PIC, (USB capable) for non-USB projects.. but well that is what I have at hand

    You can see this feature clearly in the datasheet's Pin DIagrams

    For the PIC18F2523 you have OSC1/CLKI/RA7 OSC2/CLKO/RA6
    for the PIC18F2550 you have OSC1/CLKI OSC2/CLKO/RA6

    therefore no input pin for OSC1 there
     
  15. nsaspook

    AAC Fanatic!

    Aug 27, 2009
    2,912
    2,177
    Tie the unused pin to Vss.
     
    KansaiRobot likes this.
Loading...