News:

;) This forum is the property of Proton software developers

Main Menu

Port B pullups

Started by Mike, Oct 18, 2021, 03:36 AM

Previous topic - Next topic

Mike

Hi All

I have an old project that I need to resurrect which uses a PIC 16F876A.
In the original software that I found, PORTB Pullups were enabled, but in the new compiler I get the error:
***Standard 14-=bit core devices do not support separate pin pullup resistors***
However on page 23 of datasheet DS39582C it shows in the OPTION_REG Register bit7.

Am I missing something?
Thanks
Mike

Giuseppe

Also check the registry WPUB.With which you can enable the individual resistors by bringing the bit to 1

Stephen Moss

It depends on how you are trying to pull the pins up.
If you use Option_Reg.7 = 0 then it compiles Ok, it will turn on the pullups on all PortB pins but they are automatically disabled if the pin is set to an output.
If you are trying to enable the pullups on individual pins using the PinPullup Enable command, that only works if the device has a WPU register for the port in question (in this case WPUB) which the 16F876A does not hence the warning.

See_Mos

#3
I think the original code might have been

Decalre PortB_Pullups On (or Off)

Try changing to Option_Reg.7 = 0 or RBPU = 0

The chip defaults to pullups on which is RBPU = 1

I just compiles an old sample file and checked the ASM and the Declare still works as expected.  bcf OPTION_REG,7

I then tried the new command PinPullup Enable, PORTB and got the same error as post #1

I can't find the declare in the latest manual but it still compiles OK


top204

#4
The above posts are correct... The, now legacy, devices did not have the ability to enable/disable individual Pull-Up resistors for the pins, so the original directive: "Declare PORTB_Pullups = On" is required to enable the pull-up resistors for PORTB.

This means that the newer commands to enable or disable the pull-up resistors per pin will not work on the "old" devices. Please remember, the original 16F and 18F devices are now about 20 years old!

Using the newer commands on the newer devices, it is much easier to scan and understand a program's listing because they do both things at once, so you can see if things have been enabled or disabled at the same time as the pin being made an input. :-)