It is necessary to understand basic I/O operations of PIC18F4550 before dealing with its complexities. This article presents a way to take simple output from a PIC microcontroller. This learning would also help in interfacing of external devices with the controller. Here the output from the microcontroller is taken on a set of LEDs which are made to blink in an alternate fashion.
PIC18F4550 has a total of 35 I/O (input-output) pins which are distributed among 5 Ports. The following table shows the names and numbers of I/O pins of these 5 ports:
Port Name
|
Number of Pins
|
Pins
|
PORTA
|
7
|
RA0-RA6
|
PORTB
|
8
|
RB0-RB7
|
PORTC
|
7
|
RC0-RC2, RC4-RC7
|
PORTD
|
8
|
RD0-RD7
|
PORTE
|
4
|
RE0-RE3
|
Bit 7
|
Bit 6
|
Bit 5
|
Bit 4
|
Bit 3
|
Bit 2
|
Bit 1
|
Bit 0
|
|
TRISA
|
β
|
TRISA6
|
TRISA5
|
TRISA4
|
TRISA3
|
TRISA2
|
TRISA1
|
TRISA0
|
PORTA
|
β
|
RA6
|
RA5
|
RA4
|
RA3
|
RA2
|
RA1
|
RA0
|
LATA
|
β
|
LATA6
|
LATA5
|
LATA4
|
LATA3
|
LATA2
|
LATA1
|
LATA0
|
Bit 7
|
Bit 6
|
Bit 5
|
Bit 4
|
Bit 3
|
Bit 2
|
Bit 1
|
Bit 0
|
|
TRISB
|
TRISB7
|
TRISB6
|
TRISB5
|
TRISB4
|
TRISB3
|
TRISB2
|
TRISB1
|
TRISB0
|
PORTB
|
RB7
|
RB6
|
RB5
|
RB4
|
RB3
|
RB2
|
RB1
|
RB0
|
LATB
|
LATB7
|
LATB6
|
LATB5
|
LATB4
|
LATB3
|
LATB2
|
LATB1
|
LATB0
|