Input/output ports
PIC16F877 has 5 basic input/output
ports. They are usually denoted by PORT A (R A), PORT B (RB), PORT C
(RC), PORT D (RD), and PORT E (RE). These ports are used for input/
output interfacing. In this controller, “PORT A” is only 6 bits wide
(RA-0 to RA-7), ”PORT B” , “PORT C”,”PORT D” are only 8 bits wide (RB-0
to RB-7,RC-0 to RC-7,RD-0 to RD-7), ”PORT E” has only 3 bit wide (RE-0
to RE-7).
| PORT-A | RA-0 to RA-5 | 6 bit wide |
| PORT-B | RB-0 to RB-7 | 8 bit wide |
| PORT-C | RC-0 to RC-7 | 8 bit wide |
| PORT-D | RD-0 to RD-7 | 8 bit wide |
| PORT-E | RE-0 to RE-2 | 3 bit wid |
All these ports are bi-directional. The
direction of the port is controlled by using TRIS(X) registers (TRIS A
used to set the direction of PORT-A, TRIS B used to set the direction
for PORT-B, etc.). Setting a TRIS(X) bit ‘1’ will set the corresponding
PORT(X) bit as input. Clearing a TRIS(X) bit ‘0’ will set the
corresponding PORT(X) bit as output.
(If we want to set PORT A as an input,
just set TRIS(A) bit to logical ‘1’ and want to set PORT B as an output,
just set the PORT B bits to logical ‘0’.)
o Analog input port (AN0 TO AN7) : these ports are used for interfacing analog inputs.
o TX and RX: These are the USART transmission and reception ports.
o SCK: these pins are used for giving synchronous serial clock input.
o SCL: these pins act as an output for both SPI and I2C modes.
o DT: these are synchronous data terminals.
o CK: synchronous clock input.
o SD0: SPI data output (SPI Mode).
o SD1: SPI Data input (SPI mode).
o SDA: data input/output in I2C Mode.
o CCP1 and CCP2: these are capture/compare/PWM modules.
o OSC1: oscillator input/external clock.
o OSC2: oscillator output/clock out.
o MCLR: master clear pin (Active low reset).
o Vpp: programming voltage input.
o THV: High voltage test mode controlling.
o Vref (+/-): reference voltage.
o SS: Slave select for the synchronous serial port.
o T0CK1: clock input to TIMER 0.
o T1OSO: Timer 1 oscillator output.
o T1OS1: Timer 1 oscillator input.
o T1CK1: clock input to Timer 1.
o PGD: Serial programming data.
o PGC: serial programming clock.
o PGM: Low Voltage Programming input.
o INT: external interrupt.
o RD: Read control for parallel slave port.
o CS: Select control for parallel slave.
o PSP0 to PSP7: Parallel slave port.
o VDD: positive supply for logic and input pins.
o VSS: Ground reference for logic and input/output pins.
No comments:
Post a Comment