Sunday, August 22, 2010

8051 Port functions



Ports 
 Function
Port 0
(Pin 32-39)
Dual-purpose port- 1. general purpose I/O Port.
                                2. multiplexed address & data bus                        
                                  Open drain outputs
Port 1
(Pin 1-8)

 Dedicated I/O port – Used solely  for interfacing to external devices          
                                     Internal pull-ups
Port 2
(Pin 21-28)

Dual-purpose port-  1. general purpose I/O port.
                                  2. a multiplexed address & data bus.
                                  Internal pull-ups
Port 3
(Pin 10-17)

Dual-purpose port-  1. general purpose I/O port.
                                 2. pins have alternate purpose related to special features of the 8051              
                                  Internal pull-ups

8051 PIN OUT

8051 PIN OUT 
l  Power - Vcc, Vss

l Reset - RST

l Crystal - XTAL[1,2]

l External device interfacing
      – EA, ALE, PSEN, WR, RD

l I/O Port
      – P0[7;0], P1[7:0], P2[7:0], P3

   P3 is shared with control lines
        – Serial I/O RxD, TxD,
         – external interrupts INT0,  INT1
         – Counter control T0, T1

   P0 and P2 are multiplexed with Address and Data bus


Building reset circuits for 8051

RESET is an active High input  When RESET is set to High, 8051 goes back to the power on state.
The 8051 is reset by holding the RST high for at least two machine cycles and then returning it low.

Building oscillator circuits for 8051

The 8051 uses the crystal for precisely that: to synchronize it’s operation. Effectively, the 8051 operates using what are called "machine cycles." A single machine cycle is the minimum amount of time in which a single 8051 instruction can be executed. although many instructions take multiple cycles. 
8051 has an on-chip oscillator. It needs an external crystal thats decides the operating frequency of the 8051.
 This can be achieved in two ways,,
The crystal is connected to pins 18 and 19 with stabilizing capacitors. 12 MHz (11.059MHz) crystal is often used and the capacitance ranges from 20pF to 40pF.
The oscillator can also be a TTL clock source connected with a NOT gate as shown