PIC "internal weak pull up"

Thread Starter

KansaiRobot

Joined Jan 15, 2010
324
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??
 

Thread Starter

KansaiRobot

Joined Jan 15, 2010
324
It means PORTB pins have internal pull up resistors.
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??
 

nsaspook

Joined Aug 27, 2009
13,315
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.
 

Thread Starter

KansaiRobot

Joined Jan 15, 2010
324
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...
 

jayanthd

Joined Jul 4, 2015
945
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.
 

dannyf

Joined Sep 13, 2015
2,197
Is it possible to "pull up" and "pull down" at the same time???:eek:
Yes. Some newer mcus allow both (internal) pull-up and pull-down.

How can this be possible? I am not sure but I think they are input pins btw...
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.
 

Thread Starter

KansaiRobot

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

What should I do with these unused pins???
 

nsaspook

Joined Aug 27, 2009
13,315
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?
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)
 

Thread Starter

KansaiRobot

Joined Jan 15, 2010
324
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
 
Top