Академический Документы
Профессиональный Документы
Культура Документы
PORTS
PIN DIAGRAM of 8051
8051 is a 40 Pin IC where 24 pins have dual functions : (64 pin usage)
PINS 01 08 : PORT 1
9 - RST Reset
PINS 10 17 : Port 3
10, 11 - RXD ; TXD Receive Data ; Transmit Data
12, 13 - INT0, INT1 External Interrupts
14, 15 - T0,T1 Timer 0 & Timer 1 inputs
16, 17 - , Write Strobe , Read Strobe
18, 19 XTAL 2, XTAL 1 Crystal Inputs
20 GND
PINS 21- 28 : PORT 2
Address A8 A15
29 -
30 ALE /
31 - / VPP
PINS 32 39 : PORT 0
Address lines (A0 A8) ;Data Lines (D0 D8)
40 VCC (5V)
PIN 31: EA External Access
PORT 1 (PINS 1 8)
P1.0 P1.7
8 bit Bi-directional (R/W) I/O Port
True I/O port It doesn't have any alternative functions & can be
configured as general I/O only.
8051 capable of accessing up to 64kB of external memory Needs a
path for 16 bit address
All pins of an PORT (I/O Mode) can be used as Output Pins / Input Pins
Any attempt to read pin will always get low ground signal!
To initialize a port pin as an input we must first write a logic 1 to it
MOV P2, #0FFH No way of telling if you are sending an o/p or making it
an input port
MOV A,#0FFH
MOV P1,A
MOV A,P1
MOV R7,A
ACALL DELAY
MOV A,P1
MOV R6,A
ACALL DELAY
MOV A,P1
MOV R5,A
Following code makes use of P1 as an output port
MOV A,#55H
ACALL DELAY
CPL A
SJMP BACK