PDA

View Full Version : Internal pullups on 18F45K22



Experimenter
- 2nd September 2014, 17:18
Hi,

I'm going round in circles trying to find how to set the weak pullups on Port B of the 18F45K22.

It seems to involve INTCON2 to enable the pullups; and WPUB to set the individual bits.

Could anyone assist with the correct syntax that will get through the PBP3 compiler?

Thank you!

mark_s
- 2nd September 2014, 18:29
Hi
You can add these lines to your code to enable pull-ups



TRISB = %11111111 ' Portb set to input

WPUB = %11111111 'all pull ups on portb enabled

INTCON2.7 = 0 ' 0 = enabled, 1 = off

Experimenter
- 2nd September 2014, 20:13
Hi Mark,

Thank you for this: I had tried every similar variation but failed to make it work!

Problem solved!