Specifications
mikroElektronika | Free Online Book | PIC Microcontrollers | Chapter 3: I/O Ports
Theoretically, this is a perfect solution. The problem is that all pins able
to cause an interrupt in this way are digital and have relatively large
leakage current when their voltage is not close to the limit values Vdd (1)
or Vss (0). In this case, the capacitor is discharged for a short time since
the current amounts to several hundreds of microamperes. This is why the
ULPWU circuit able to register slow voltage drops with ultra low power
consumption was designed. Its output generates an interrupt, while its
input is connected to one of the microcontroller pins. It is the RA0 pin.
Referring to Fig. 3-4 (R=200 ohms, C=1nF), discharge time is
approximately 30mS, while the total consumption of the microcontroller
is 1000 times lower (several hundreds of nanoamperes).
Fig. 3-4 Sleep Mode
Port B and TRISB Register
Port B is an 8-bit wide, bidirectional port. Bits of the TRISB register determine the function of its pins.
Fig. 3-5 Port B and TRISB register
Similar to Port A, a logic one (1) in the TRISB register configures the appropriate port pin as input and vice versa. Six pins
on this port can act as analog inputs (AN). The bits of the ANSELH register determine whether these pins act as analog
inputs or digital inputs/outputs:
● RB0 = AN12 (determined by bit ANS12 of the ANSELH register);
● RB1 = AN10 (determined by bit ANS10 of the ANSELH register);
● RB2 = AN8 (determined by bit ANS8 of the ANSELH register);
● RB3 = AN9 (determined by bit ANS9 of the ANSELH register);
● RB4 = AN11 (determined by bit ANS11 of the ANSELH register); and
● RB5 = AN13 (determined by bit ANS13 of the ANSELH register).
Each Port B pin has an additional function related to some of the built-in peripheral units, which will be explained in later
chapters.
● All the port pins have built in pull-up resistor, which make them ideal for connection to push-buttons, switches and
optocouplers. In order to connect these resistors to the microcontroller ports, the appropriate bit of the WPUB
register should be set.*
http://www.mikroe.com/en/books/picmcubook/ch3/ (4 of 10)5/3/2009 11:32:31 AM