Specifications

mikroElektronika | Free Online Book | PIC Microcontrollers | Chapter 3: I/O Ports
there is to know about these Ports. However, they are probably the simplest modules within the microcontroller. This is
how they are used:
When designing a device, select a port through which the microcontroller will communicate to the peripheral
environment. If you intend using only digital inputs/outputs, select any port you want. If you intend using some of
the analog inputs, select the appropriate ports supporting such pins configuration (AN0-AN13);
Each port pin may be configured as either input or output. Bits of the TRISA, TRISB, TRISC, TRISD and TRISE
registers determine how the appropriate ports pins- PORTA, PORTB, PORTC, PORTD and PORTE will act;
If you use some of the analog inputs, set the appropriate bits of the ANSEL and ANSELH registers at the beginning of
the program;
If you use switches and push-buttons as input signal source, connect them to Port B pins because they have pull-up
resistors. The use of these resistors is enabled by the RBPU bit of the OPTION_REG register, whereas the installation
of individual resistors is enabled by bits of the WPUB register; and
It is usually necessary to react as soon as input pins change their logic state. How ever, it is not necessary to write
a program for changing pins' logic state. It is far simpler to connect such inputs to the PORTB pins and enable the
interrupt on every voltage change. Bits of the registers IOCOB and INTCON are in charge of that.
Previous Chapter | Table of Contents | Next Chapter
http://www.mikroe.com/en/books/picmcubook/ch3/ (10 of 10)5/3/2009 11:32:31 AM