Page 43 - Making PIC Microcontroller Instruments and Controllers
P. 43
32 UNDERSTATIDITIG MIChOCHIF IECHI{OIOGY S PIC l6F677A: A DESCFIPTIOI{ OF tHE MCU
se this ?in witllout cancem. (Utuler certain situations, the Jie(tuencJ on thili pin can
be set hieh enough to be above hLnan heating runge, allo\,)ing the pin to be used Like
PORTD
PORTD is a full s-bilwide bidirectional porl.
All the pins on PORTD have Sshmiu trigger input bullers. This mcans they are
designed to be more immune to noise on the inpur lines.
PORTD can also be configured as a microprocessor port by setting PSPMODE
through setting TRISE.4 to 1. (Note that we are specifying bil 4 of PORTE herc inter
nally; lhere is no extemal pin4.) In this odc. all lhe input pins are in TTL mode. (See
page 48 of the datasheet.)
The alterrate function of the PORTD pins arc delined as lbllowsl
Bit D0 or parallel slave port bit 0
Bit Dl or parallel slavc port bit 1
Bjt D2 orparallel slave port bit 2
Bit D3 orparallel slave poft bit 3 Port D is lhe
Bit D4 or parallel slave polt bit4 parallcl slave port
Bit D5 orparallel slave port bit 5
Bir D6 or parallel slave port bit 6
Bit D7 or parallel slave poll bit 7
The registers ihat control PORID are TRISD and TRISE. TRISE controls the oper-
ation of the PORTD parallel slave port mode wher Bit TRISE.4 is sel10 l. (Rcmember
again that only pins E0, El, and E2 are available external to the MCU on PORTE.)
Slave porr functions as set by PORTE when BitTRISE.4 is set 1() 1 are:
/
Bit TRISE.0 dircction control ofPin PORTE.o RD /AN5
Bit TRISE.I direction control of Pin PORIE.I / WR /AN6
/
Bit TRISE.2 direction control of Pin PORTE.2 CS /AN7
BilTRISE.3, NOT USED
Bit TRISE.,I Slave poft select l=Slave port selected
=Use as slandard l/O port
Bit TRISE.5 Buffer overfiow detect l=Write occurred before reading old dala
o=No effor occufed