Hola,
Que sentencia ha y que utilizar en el bloque de código C para activar las resistencias internas de las líneas RB4, RB5, RB6 y RB7 en un microcontrolador Pic 16F886.
C.
Pull-up internas como activarlas?
-
- Posts: 132
- http://meble-kuchenne.info.pl
- Joined: Thu Oct 14, 2021 10:04 am
- Has thanked: 53 times
- Been thanked: 4 times
Pull-up internas como activarlas?
Last edited by Carmelo on Sat Jul 26, 2025 11:41 pm, edited 1 time in total.
-
- Valued Contributor
- Posts: 1639
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 361 times
- Been thanked: 575 times
Re: Pullu-up internas como activarlas?
Hi
If you look in the datasheet, section 3.4.2 Weak Pull-Ups, you will find the details of the register you need to set. The register is 8-bits wide for Port B so you can select / set whichever bits you need.
In the C-Code block enter the register name and value (e.g. REG=0b11110000).
Regards
If you look in the datasheet, section 3.4.2 Weak Pull-Ups, you will find the details of the register you need to set. The register is 8-bits wide for Port B so you can select / set whichever bits you need.
In the C-Code block enter the register name and value (e.g. REG=0b11110000).
Regards
Re: Pull-up internas como activarlas?
Gracias por la respuesta.
Entonces entiendo que en el bloque C habría que escribir lo siguiente:
OPTION_REGbits.RBPU = 0;
Para habilitar de forma general las pull-up y después:
WPUB=0b11110000;
Para habilitar de forma individual las resistencias de la pines RB4 a RB7
C.
Entonces entiendo que en el bloque C habría que escribir lo siguiente:
OPTION_REGbits.RBPU = 0;
Para habilitar de forma general las pull-up y después:
WPUB=0b11110000;
Para habilitar de forma individual las resistencias de la pines RB4 a RB7
C.
Last edited by Carmelo on Sun Jul 27, 2025 12:02 am, edited 1 time in total.
-
- Valued Contributor
- Posts: 1639
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 361 times
- Been thanked: 575 times
Re: Pull-up internas como activarlas?
Hi
Bits are 7 - 0 so to set RB7-RB4 it would be 0b11110000
Regards
PS
When setting register bits I find it helpful to use binary but of course you can use hex or decimal if you prefer
0b11110000 = 0xF0 = 240
Bits are 7 - 0 so to set RB7-RB4 it would be 0b11110000
Regards
PS
When setting register bits I find it helpful to use binary but of course you can use hex or decimal if you prefer
0b11110000 = 0xF0 = 240
Re: Pull-up internas como activarlas?
Grcacias por la respuesta.
me equivoque al escribir el codigo del registro WPUB.
En concreto las lineas a insertar serian:
OPTION_REGbits.RBPU = 0;
WPUB=0b11110000;
me equivoque al escribir el codigo del registro WPUB.
En concreto las lineas a insertar serian:
OPTION_REGbits.RBPU = 0;
WPUB=0b11110000;
-
- Valued Contributor
- Posts: 1639
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 361 times
- Been thanked: 575 times
Re: Pull-up internas como activarlas?
Hi
Glad you have it working. I too have been caught by names before
Regards
Glad you have it working. I too have been caught by names before

Regards