EasyPIC4 User
’
s Manual
2
20
0
page
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
MikroElektronika
Development
tools
PP
UU
SS
HH
BB
UU
TT
TT
OO
NN
SS
WW
IITT
CC
HH
EE
SS
EasyPIC
ICD
4
On Fig. 24 the JP21 switch is
set to pull-up, therefore when
the button is not pressed,
pull-up resistor pulls the
microcontroller’s RB4 pin to
+5V.
A button press causes the
port pin to be connected to
ground (JP17 is in the lower
position).
Thus, only when the button is
pressed the microcontroller
will sense a logical zero; oth-
erwise the pin state will
always be logical one.
On Fig. 25 the JP21 switch is
set to pull-down, therefore
when the button is not
pressed, pull-down resistor
pulls the microcontroller’s
RB4 pin to 0V.
A button press causes the
port pin to be connected to
+5V (JP17 is in the higher
position).
Thus, only when the button is
pressed the microcontroller
will sense a logical one; oth-
erwise the pin state will
always be logical zero.
RB4
PortB
pull-up
0V while pressed
vcc
DIP40
RA0
RA1
RA2
RA3
RA4
RA5
RE0
RE1
RE2
RD6
RD7
RB0
RB1
RB2
RB3
RB4
RB5
RB7
RB6
VDD
VSS
MCLR
VDD
VSS
vcc
JP21
JP17
RB4
PortB
pull-down
5V while pressed
vcc
DIP40
RA0
RA1
RA2
RA3
RA4
RA5
RE0
RE1
RE2
RD6
RD7
RB0
RB1
RB2
RB3
RB4
RB5
RB7
RB6
VDD
VSS
MCLR
VDD
VSS
vcc
JP21
JP17
Figure 24.
Figure 25.
Button with pull-up resistor
Button with pull-down resistor