port
A port is a device
to receive the bytes from external
peripheral(s) [or device(s) or processor(s)
or controllers] for reading them later using
instructions executed on the processor
Or to send the bytes to external
peripheral or device or processor using
instructions executed on processor
example
SI serial interface in 8051
SPI serial peripheral interface in 68HC11
PPI parallel peripheral interface 8255
Ports P0, P1, P2 and P3 in 8051 or PA, PB,
PC and PD in 68HC11
COM1 and COM2 ports in an IBM PC
I/O port types
1.Serial input output ports
2.Parallel input output ports
Serial I/O ports
Synchronous Serial Input
Synchronous Serial Output
Asynchronous Serial UART input
Asynchronous Serial UART output
Both as input and as output, for example,
modem.
Parallel I/O ports
Parallel port one bit Input
Parallel one bit output
Parallel Port multi-bit Input
Parallel Port multi-bit Output
For example
IF we take pic microcontroller it have
five input output ports which are:
1.Port A
2.Port B
3.Port C
4.Port D
5.Port E
Pic18f458 (as example)
PIC18F458 has totally 40 Pins, A total of
33 pins are set aside for the five
ports PORTA , PORTB, PORTC,
PORTD and PORTE .
We can use these ports as
a INPUT OrOUTPUT ports. The rest of
the pins are designated for Vdd(Vcc),Vss
(GND),OSC1,OSC2,MCLR(reset) and
another set of Vdd and Vss
Pins of ports
PORTA 7 pins
PORTB 8 pins
PORTC 8pins
PORTD 8 pins
PORTE 3 pins
Block Diagram of I/O Interfacing
Buffer
Access one port at a time
8-bit registers
I/O ports are associated with a SFR Latch
Each port is associated with 3 registers:
PORT / LAT / TRIS
PIC18F452/4520 I/O Ports (1 of 5)
MCU includes five I/O ports
PORTA, PORTB, PORTC, PORTD, and PORTE
Ports are multiplexed meaning they can be
set up by writing instructions to perform
various functions
Interfacing Output Peripherals (1 of 2)
Commonly used output peripherals in embedded systems are
LEDs, seven-segment LEDs, and LCDs; the simplest is LED
Two ways of connecting LEDs to I/O ports:
LED cathodes are grounded and logic 1 from the I/O port turns on the
LEDs - The current is supplied by the I/O port called current sourcing.
LED anodes are connected to the power supply and logic 0 from the
I/O port turns on the LEDs - The current is received by the chip called
current sinking.
Common Cathode Common Anode
Active high Active low
Interfacing Seven-Segment
LEDs as an Output (1 of 4)
Seven-segment LEDs
Often used to display BCD numbers (1 through
9) and a few alphabets
A group of eight LEDs physically mounted in
the shape of the number eight plus a decimal
point as shown in Figure 9-5 (a)
Each LED is called a segment and labeled as ‘a’
through ‘g’.
Interfacing Seven-Segment LEDs as
an Output (2 of 4)
Two types of seven-
segment LEDs
Common anode
Common cathode
decimal point
Seven-Segment Chips
ALPHA/NUMERI
C C/A DISPLAY
Interfacing Input Peripherals
Commonly used input peripherals in embedded
systems are:
1.Push button keys
2.Dip switches
3.Keyboard
4.Mouse
5.touchscreen
Output devices
1.LCD screen
2.Printer
3.PC’s