PICs and Weak pull-ups

Jan 09, 2005 3 Replies

As I understood, weak pull-ups meant unconnected input pins would read as 1... It's taken me nearly 8 hours to figure out what's wrong, but now I've sussed it..



I've got three inputs. They're all connected via a "push to make" switch to ground. When the switch isn't pressed, they're not connected to anything, which I understand would pull them high.



This seems to be the case, until *any one* of the 3 inputs goes low (connected to ground via my switch), which pulls *all three* inputs low.



By connecting the inputs to +4.5V when they're not connected to ground, all works fine. Connecting them with 10K resistors doesn't work, and the original (unconnected) behaviour returns.



Is this correct, have I done something or is my chip a bit screwed?


Danny

That's wrong, I must've connected wrong, since it works fine with 10K resistors. It's just without - it's as if the weak pull-ups don't work (the global setting is 0, but all pull-ups 1 on power. I set the global setting to 1).

Ah well, I'll just leave them off and do it myself!

Danny

The plot thickens... I just made a change to my code (unrelated) and re-programmed it. Now, with 10K resistors, it doesn't seem to work with pull-ups turn on or off!

I'll do some further digging after breakfast - it's probably user error!!

Danny

Danny T

I only recently started learning to program PICs myself and haven't yet used the pull-ups but I read something today which explains why I thought I'd zapped RA4 on a 16F84A - LED wouldn't light. It may be of help in the future if you don't already know. I'm not sure if it applies to other PIC though.

*********************************** Nigel's PIC Tutorial Page.

The 16F628 has it's I/O pins split across two ports, PortA and PortB, these have quite different properties, and it's important to understand these differences or things don't always work as you expect!. Firstly PortB, this is pretty straightforward, although some of the pins can be used by various of the built-in hardware, as a normal port all pins can be inputs or outputs. PortA is a little less straightforward, all pins can be used as inputs, but RA5 can only be used as an input, and RA4 has an 'open-collector' output stage, this means it requires a 'pull up' resistor to function as a 'normal' output - it can 'sink' current, but can't 'source' it. RA4 in the

16F84 has the same properties - this is often a cause of problems. ***********************************

Cheers,

Andrew.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required