Académique Documents
Professionnel Documents
Culture Documents
P 0 .0 to P 0 .7 P 2 .0 to P 2 .7
P o r to D r iv e r P o r to 2 D r iv e r
P ro g ra m
B r e g is te r ACC S ta c k a d d re s s
P o in te r r e g is te r
TM P2 TM P1
B u ffe r
PC
ALU
In c r e -
IN T , S e r ia l P o r t, m ent
PSW & T im e r B lo c k s
P ro g
PSEN C o u n te r
ALE / PROG T im in g IN S T
& Reg
EA /VPP DPTR
C o n tro l
RST
P o r t1 P o rt3
L a tc h L a tc h
O SC P o r t1 D riv e r P o r t3 D r iv e r
P 1 .0 to P 1 .7 P 3 .0 to P 3 .7
2.3 FEATURES
9. 8-Interupt Source.
(T 2) P 1 .0 . 1 40 VCC
T 2 (E x ) P 1 .1 2 39 P 0 .0 (A D 0)
P 1 .2 3 A 38 P 0 .1 (A D 1)
T
P 1 .3 4 37 P 0 .2 (A D 2)
P 1 .4 5 36 P 0 .3 (A D 3)
P 1 .5 6
M 35 P 0 .4 (A D 4)
P 1 .6 7 34 P 0 .5 (A D 5)
P 1 .7 8 E 33 P 0 .6 (A D 6)
L
RST 9 32 P 0 .7 (A D 7)
(R XD ) P 3 .0 31 EA /VPP
(T XD ) P 3 .1 11
8 ALE / PRO G
(IN T O ) P 3 .2 12 29 PSEN
(IN T 1 ) P 3 .3 . 13 9 28 P 2 .1 (A 15)
C
(T 0) P 3 .4 14 27 P 2 .6 (A 14)
(T 1) P 3 .5 15 26 P 2 .5 (A 13)
(W R ) P 3 .6 16
5 25 P 2 .4 (A 12)
(R D ) P 3 .7 17 24 P 2 .3 (A 11)
X TA L 2 18 2 23 P 2 .2 (A 10)
X TA L 1 19 22 P 2 .1 (A 9)
G ND 20 21 P 2 .0 (A 8)
2.5 PIN DESCRIPTION OF 89C51
PORT O: Port O is an 8 bit open drain bi-directional I/O port. Each pin
can sink 8 TTL I/P’s. It can be configured to be multiplexed low order
Address / Data bus during access to external program and data memory.
When a pin is to be used as an I/P, a 1 must be written to a
corresponding port O latch by the program, thus turning both of the
transistor OFF, which in turn causes the pin to float in high impedance
state, and the pin is connected to I/P buffer. When used as an O/P the
pin latches that are programmed to a 0 will turn ON the lower FET
grounding the pin. All latches that are programmed to a 1 still float; thus,
external pull-up resistors will be needed to supply a logic high when using
port O as an O/p.
Port O also receives the code bytes during flash programming and
O/P’s the code bytes during program verification.
Port 2 also receiveres the high order address bits and some control
signals during flash programming and verification.
ALE /PROG: Address latch enable is an O/p pulse for latching the low
byte of the addressing during accesses to external memory. This pin is
also the program pulse I/p (PROG) during flash programming.
This pin also receives the 12 volt programming enable voltage VPP
during flash programming when 12 volt programming is selected.
The counters are divided into two 8 bit registers called the timer low
TL0 , TL1 and high TH0, TH1 bytes. All counter action is controlled by bit
states in the timer mod control register TMOD, the timer/counter control
register TCON and certain program instructions.
The modes are selected by bits in T2CON Timer 2 Consists of two 8 bit
registers TH 2 and TL2. In the timer function, the TL2 register is
incremented every machine cycle. Since a machine cycle consists of 12
oscillator’s period, the count rate is 1/12 of the oscillator frequency.
The heart of the 89C52 is the circuitary that generates the clock pulses by
which all internal operations are synchronized. Pins XTALI and XTAL2 are
provided for connecting a resonant network to form an Oscillator. The
Crystal frequency is the basic internal clock frequency of the
microcontroller. The manufacturers make available 89C52 designs that
can run at specified maximum and minimum frequencies. Typically 1MHz
to16 MHz . Minimum frequency imply that some internal memories are
dynamic must always operate above a minimum frequency or data will be
lost.
C = 82 P F
18 X TA L 2
C ry s ta l
1 1 .0 5 9 2
19 X TA L 1
C = 82 P F
The bits in the register IE will decide, which interrupts are active or
enabled. The MS Bit of the IE register is the global enable bit, labeled as
EA. If this bit is 1 means interrupts are enabled, otherwise all interrupts
are disabled. Other bits in the IE register will enable, if they are 1 or
disable if they are 0, the individual interrupts. The IE has a place in SFR
area and its address is A8 Hex. It is a Bit Addressable Register. The next
fig. gives idea of IE.
--- : Reserved.
ES : Serial interface.
ET1 : Timer 1.
EX1 : External Interrupt 1.
ET0 : Timer 0.
0=Disabled.
1= Enabled
There is a provision to decide the priority of the interrupt, either High
or Low. If lower priority interrupt work is in progress, and higher priority
interrupt arrives. Then lower priority interrupt work will be suspended,
processor will branch to higher priority service routine. After finishing
higher priority work, it will resume the execution of lower priority
interrupt. After finishing execution of lower priority interrupt, the
processor will go back to start the execution of main program. If higher
priority interrupt is in progress and lower priority interrupt arrives then
lower priority interrupt will be kept pending till the execution of higher
priority interrupt ends. After finishing higher priority interrupt processor
will start the execution of lower priority interrupt. After finishing the same,
processor will go back to main program. The address of the register is B8
Hex in the SFR area. It is a Bit Addressable Register. The next fig. gives
idea of IP.
Timer overflow bit TF0 or TF1 will set, whenever counter overflows
from FFFF Hex to 0000 Hex. They will automatically get cleared, when
program branches to respective interrupt service routine.
The bits RI and TI in the serial interface logic will be ORed and will
generate one common interrupt. If these interrupts are enabled, then
program will start execution at ROM address 0023 Hex. These bits will not
get cleared automatically. Program will find who has caused the interrupt.
Then will take the appropriate action and program will clear the bit. The bits
TI and RI are found in Serial Control Register (SCON). The register SCON is
found at address 98 Hex in the SFR area.