Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Pull up resistor Help!

Status
Not open for further replies.

stolzie

New Member
Hi,

I have an issue which I am not sure how I can get around and I need some help/adivse on some possible solutions that could be implemented.

I currently have an 8 bit bus that is a direct connection to a Port on a PIC18FXXXX that does not have programmable internal pullups available on the port.

What I need to do on the port is to be able to turn on pullups when the port is set for input and turn off pullups on the port when they are set to output.

I was thinking of using a bussed resistor network connected to VCC via a FET, and turning the FET on when set to input via a spare I/O pin. But I thought when the port is set to outputs, and the pins are toggled to certain states I would get a connection between certain port pins. So all pins would be in the on state?

If anyone can provide any useful tips or tricks that would be handy. I have been looking around at various other methods using mutliple fets and single resistors, but this option maybe the only way to go.

Thanks

Stolzie
 
stolzie said:
What I need to do on the port is to be able to turn on pullups when the port is set for input and turn off pullups on the port when they are set to output.

Why would you want to do it? - it seems completely pointless?.
 
hi,

Well, Nigel, I'm sure he has his reasons.

stolzie, I'm not sure you realise what pull ups are for. They are simply to force the pins to a known state when they are floating, in this case 'high', or '1'. However, in order to get the pins into a known state they really don't need much current at all. I've used 47k pullups, and they worked fine. You're right about the pins being 'connected' but the amount of current able to flow through one resistor, along the bus, and through another resistor is nothing compared to the drive current on the pin. That will hold it at the state you set it, unless you use really low value pulls ups, like 47ohms or something.

So, when they are all outputs, and you set say 'pin7' high, and the rest low, what we have is a '+5V' (assuming that the micro is running on 5v) connected to ground via a pull-up resistor, in series with seven parallel resistors. With me so far?

For a bused 10k pull up resistor network (all commoned) the resistance between the 'on' pin and all the 'off' pins is 10k + 1.429k = 11.429K. V=IR, where V is 5v. I = 5/11429 = 0.44mA < = thats not much.

Between two pins, one on and one off, it must go through 20k (two 10k resisotrs, meaning the current flowing would be 0.25mA.

I would say you don't need to switch in and out the pull-up resistors at all. As long as they pull up the pins to the state you desire when the pins are configured as inputs, and they are of a reasonably high value (>10k) then I don't think you'll have problems. Although, using an FET to control pull-ups is a pretty good idea, might have to use that someday (but not for this app).

One final thing, I once designed a board, that had 128 I/O's. Each group of 8 I/O's used a resistor network. In my ignorance I used 1K resistors, not much....but for 128 I/O's that meant that with no inputs connected the board used 128*5 = 640mA.

Anyway, hope this helps,

Blueteeth
 
Blueteeth said:
Well, Nigel, I'm sure he has his reasons.

Can you think of one?.

I suspect (as it looks like you do?, from the long explanation you posted!) that he doesn't understand what they really do, and how they do absolutely nothing if the I/O is configured as an output.
 
Thanks Blueteeth for your reply. I will have to do the maths and work out the best value resistor to use.

As for your 128 I/O board that is a lot of I/O's!

May I ask how you actually implemented that number of I/O's?

I have been looking at the GPIO expanders from Microchip that use SPI to get more I/O's but obviously there are a number of different ways you can go about implementing this sort of stuff.

Nigel Goodwin said:
Why would you want to do it? - it seems completely pointless?.

Well I am not sure what the end user is going to use the programmable I/O pins for so it has to be selectable for both input and output. The last micro contoller that I used had programmable internal pullups on all the I/O pins but due to RoHS they are not making this chip anymore. So I am moving the design to PIC and I want to keep the same functionality as the previous micro controller if possible.

Thanks again for the replys

Stolzie
 
stolzie said:
Thanks Blueteeth for your reply. I will have to do the maths and work out the best value resistor to use.

As for your 128 I/O board that is a lot of I/O's!
May I ask how you actually implemented that number of I/O's?

I have been looking at the GPIO expanders from Microchip that use SPI to get more I/O's but obviously there are a number of different ways you can go about implementing this sort of stuff.

Sure, it was actually for a CPLD (several to be precise) which were a bit funny about I/O's, they probably should have all been buffered as each chip could only sink about 100ma.. they got hot :D

As for expanding I/O's, for SPI, shiftregister obviously, simple serial to parallel. For each 'shift register' you'll need a CS (chip select) line, which could be used as both an 'enable line', so the shiftregister accepts the data, and as a 'strobe' line, which loads in the new bits to the outputs. It'll mean you'll have to write at least a new byte if you want to change just one bit, but a micro has more than enough memory to store all the current values. You just need to XOR the old byte with the a byte of bits you want to change.

If you use 8-bit SR's, because you'll need a CS line for each one, that limits how many I/O's. For say SPI and 10 I/O's on your micro, that exapnds to 80 I/O's. You could stick two shift registers in series, pull its CS low, write TWO bytes, then pull the CS high again, so thats 16 I/O's per CS line, giving 160 expanded I/O's. As for chips, I used the CD4094 (or HEF4094?) and the 74HC164. The former was better because it buffered the output, meaning instead of the pins 'seeing' the shift, they remained the same state until a 'load' line loaded in the new value. Sorry, I'm ranting, but its how I've done it, and it works like a charm, god bless SPI :D


Nigel Goodwin said:
Can you think of one?.

I suspect (as it looks like you do?, from the long explanation you posted!) that he doesn't understand what they really do, and how they do absolutely nothing if the I/O is configured as an output.

Well, if he didn't understand what pull ups are for, he does now. And the reason I typed such a long message is because I tend to rant, and also, he asked for advice. A simple 'pointless' doesn't really help much. For practical purposes, you are right of course, they don't do much, but they do do something if their value is chosen to be too low, which they shouldn't be. I'm not arguing here, I simply wanted to answer a question, after all, this board is a great place to learn, and share idea's. :)

As for your 'clients board' stolzie, your solution of an FET controlled pull up system does seem to be a reasonable 'substitute' for a PIC internal pull-ups, if not a little overkill (uses up a precious I/O), I'm almost certain that they will be fine permentantly connected, as long as the value is high enough. No real maths needed, I'd say 10k-47K, maybe 100k would be a little too high, but this isn't an exact science its only there to pull pins high, I can't think of a situation where they would cause problems when the pins are outputs.

Good Luck,

Blueteeth.
 
stolzie said:
Well I am not sure what the end user is going to use the programmable I/O pins for so it has to be selectable for both input and output.

The reason I asked is that you can leave the pullups permanently connected, it makes no difference at all if the pins are outputs - the pullups won't affect them in any way - so there's no need to disconnect them.

The only reason you 'might' want to disconnect them is if the pins are configured as INPUTS - and you don't want to use pullups?. But for outputs there's no reason.
 
Well thank you both very much for the information.

It has been a great help. It looks as those I might permantly connect the pull up resistors and use the spare I/O's that I was going to use on the FET's for something else.

I will probably wire up a prototype today and see how it all works with various inputs and outputs.

Thanks again for your help.

Cheers

Stolzie
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top