View previous topic :: View next topic |
Author |
Message |
Eugeneo
Joined: 30 Aug 2005 Posts: 155 Location: Calgary, AB
|
How to setup a portb weak pullup |
Posted: Sat Oct 21, 2006 3:01 am |
|
|
for the 18f2525 it says in the data sheet
INTCON2<7> can be cleared to turn on the portb pullups and can be set by individual port latches.
Can anyone tell me where the port latches are located?
Thanks in advance |
|
|
Ttelmah Guest
|
|
Posted: Sat Oct 21, 2006 4:52 am |
|
|
The instruction - 'PORT_B_PULLUPS(TRUE)', clears this bit, to enable the pullups.
The pullups are only enabled, if the pin is set as an input, which is controlled by the TRIS instruction, or (if using 'standard_io'), by simply reading the register.
The actual line in the data sheet you are reading (register 9-2), is misleading, and is corrected in section 10-2 of the sheet. It is the TRISD register setting, not the data latch setting that controls the individual pull-ups.
The data latch, is what you talk to, when you output data.
Best Wishes |
|
|
Eugeneo
Joined: 30 Aug 2005 Posts: 155 Location: Calgary, AB
|
|
Posted: Sat Oct 21, 2006 3:21 pm |
|
|
Thank you for that info.
I guess that means all inputs are pulled up when the pull ups are enabled and all outputs are disabled automatically.
Is there any way of setting an individual pullup to be off? I need ext(B0) and ext1(b1) to floating and these are going to be inputs. I need B2-7 to be pulled up.
It looks like I may need a resistor sip. |
|
|
Ttelmah Guest
|
|
Posted: Sun Oct 22, 2006 2:40 am |
|
|
Not on this chip.
Some of the smaller chips allow the pullups to be individually selected. This one doesn't. However, remember they are very low current (50uA each), so will typically not matter if enabled on pins that don't need them.
Best Wishes |
|
|
|