Specifications

Chapter 2 - Microcontroller PIC16F84
logical one into logical zero and opposite. Only pins configured as input can cause this interrupt to
occur (if any RB7:RB4 pin is configured as an output, an interrupt won't be generated at the
change of status.) This interrupt option along with internal pull-up resistors makes it easier to
solve common problems we find in practice like for instance that of matrix keyboard. If rows on
the keyboard are connected to these pins, each push on a key will then cause an interrupt. A
microcontroller will determine which key is at hand while processing an interrupt It is not
recommended to refer to port B at the same time that interrupt is being processed.
The above example shows how pins 0, 1, 2, and 3 are declared for input, and pins 4, 5, 6, and 7
for output.
PORTA
PORTA has 5 pins joined to it. The corresponding register for data direction is TRISA at address
85h. Like with port B, setting a bit in TRISA register defines also the corresponding port pin as an
input pin, and clearing a bit in TRISA register defines the corresponding port pin as an output pin.
The fifth pin of port A has dual function. On that pin is also situated an external input for timer
TMR0. One of these two options is chosen by setting or resetting the T0CS bit (TMR0 Clock Source
Select bit). This pin enables the timer TMR0 to increase its status either from internal oscillator or
via external impulses on RA4/T0CKI pin.
Example shows how pins 0, 1, 2, 3, and 4 are declared to be input, and pins 5, 6, and 7 to be
output pins.
Previous page Table of contents Chapter overview Next page
© Copyright 1999. mikroElektronika. All Rights Reserved. For any comments contact webmaster.
http://www.mikroelektronika.co.yu/english/product/books/PICbook/2_05Poglavlje.htm (2 of 2) [4/2/2003 16:17:47]