PIC16F84A Enable PORTB internal pull-ups with CCS C compiler

Each of the PORTB pins has a weak internal pull-up. A single control bit can turn on all the pull-ups. This is performed by clearing bit RBPU (OPTION<7>). The weak pull-up of a pin is automatically turned off when the port pin is configured as an output. This post shows how to enable PIC16F84A microcontroller PORTB internal pull-ups.
The following CCS C compiler line can enable all the internal pull-ups of PORTB:
port_b_pullups(true) ;
And the following line can disable all the internal pull-ups of PORTB:
port_b_pullups(false) ;

PIC16F84A enable PORTB internal pull-ups example:
The following topic shows how to turn on and off 2 LED using 2 push buttons where two 10K resistors are used to pull-up the microcontroller input pins.
PIC16F84A LED blink using push button – CCS C compiler
Now let’s make the same example with the internal pull-ups are enabled and the external ones are removed as shown in the following circuit schematic:
PIC16F84A enable PORTB internal pull-ups example circuit
The circuit is simple there 2 LEDs and 2 buttons each button toggles one LED for example when the first push button which is connected to RB0 is pressed, the first LED which is connected to RA0 turns ON, and when the same button pressed again the same LED turns OFF, and the same thing for the second button and the second LED.

Enable PORTB internal pull-ups CCS PIC C code:


Discover more from Simple Circuit

Subscribe to get the latest posts sent to your email.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top