PDA

View Full Version : PIC18F4550 internal pull-ups



Klaus
- 14th April 2008, 21:07
Hi,
I'm using a PIC18F4550 and wanted to program port B for the internal pull-ups on all inputs. The data sheet says I can do this in software, but I can't seem to find anything in the PIC Basic Pro compiler manual. Can someone tell me how to do this?
Thanks,
Klaus

mister_e
- 14th April 2008, 21:27
Hi Klaus,
welcome on the forum. The beauty of the compiler is that you can access each and every PIC register to do what YOU want to do. Here, it's not a compiler built-in feature you need, it's a specific PIC feature you need to enable/disable.

Let's see the datasheet (yeah you must make friend with it... even if this one is pretty big) i heard the size don't matter :D

http://ww1.microchip.com/downloads/en/DeviceDoc/39632D.pdf

PDF page 69 , table 5-2, find INTCON2 register and look bit 7 RBPU..ok ok.. i agree for now it doesn't mean anything...

Go at page 102, There you find the whole explanation for this INTCON2 register and RPBU bit.

As you see, to enable the internal pull-up, you just need to 'clear' bit 7 of this register. How to? Easy..

INTCON2.7=0

That's it that's all

Klaus
- 14th April 2008, 22:05
Many thanks. It will take me awhile to get familiar with this. Been using a basic stamp so this is all new to me.
Klaus

mister_e
- 14th April 2008, 22:55
You're welcome... once you use PIC, you never go back to Stamps. Big jump though.