The following code demonstrates how to set the weak pull-ups available on port b of an 18F25K20. It is for anyone who may be having trouble with this
' program tests use of weak pulled-ups on portb.
' tests good effective R pullup about 33 K ohms.
'Set chip model:
#chip 18F25k20,16 'at 16 MHz
'Switch Low-Volt-Programming:
#config LVP = Off
#config MCLR = Off
'Set internal clock speed to 16 MHz:
Set IRCF0 = 1
Set IRCF1 = 1
Set IRCF2 = 1
Set RBPU = 0 'enabling Port B pullups in general.
SET WPUB1 = 1 'portb.1 pulled up
Set WPUB2 = 1 'portb.2
Set WPUB3 = 1 'portb.3
Set WPUB4 = 1 'portb.4
Dir Portb in
Dir Portc out
do
Let portc.1 = portb.1 'in pin 22, out pin 12
Let portc.2 = portb.2 'in pin 23, out pin 13
Let portc.3 = portb.3 'in pin 24, out pin 14
Let portc.4 = portb.4 'in pin 25, out pin 15
loop 'jump back to the start of the program
'main line ends here
end
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The following code demonstrates how to set the weak pull-ups available on port b of an 18F25K20. It is for anyone who may be having trouble with this
' program tests use of weak pulled-ups on portb.
' tests good effective R pullup about 33 K ohms.
'Set chip model:
#chip 18F25k20,16 'at 16 MHz
'Switch Low-Volt-Programming:
#config LVP = Off
#config MCLR = Off
'Set internal clock speed to 16 MHz:
Set IRCF0 = 1
Set IRCF1 = 1
Set IRCF2 = 1
Set RBPU = 0 'enabling Port B pullups in general.
SET WPUB1 = 1 'portb.1 pulled up
Set WPUB2 = 1 'portb.2
Set WPUB3 = 1 'portb.3
Set WPUB4 = 1 'portb.4
Dir Portb in
Dir Portc out
do
Let portc.1 = portb.1 'in pin 22, out pin 12
Let portc.2 = portb.2 'in pin 23, out pin 13
Let portc.3 = portb.3 'in pin 24, out pin 14
Let portc.4 = portb.4 'in pin 25, out pin 15
loop 'jump back to the start of the program
'main line ends here
end