Professional Documents
Culture Documents
B2
P1.X
Clk Q
P1.X pin M1
B1 Read pin
2 Tri-state buffer
B1: controlled by Read pin
Read pin1really read the data present at the pin
A transistor M1 gate
Gate=0: open Gate=1: close
Read latch B2
1 0
M1
P1.X
Clk Q
output 1
B1 Read pin
Read latch B2
0 1
M1
P1.X
Clk Q
output 0
B1 Read pin
1. 2.
B2
Internal Pull-Up
Q
P1.X 1 M1 1
Clk
Write to latch
Q
0
Internal Pull-Up D Q
P1.X 1 0
external pin=Low
P1.X pin
Write to latch
Clk
M1
Important Pins
PSEN (out): Program Store Enable
ALE (out): Address Latch Enable to latch address outputs at Port0 and Port2
EA (in): External Access Enable to access external program memory 0 to 4K (active low)
RXD,TXD: UART pins for serial I/O on Port 3 Vccpin 40: +5V (3~5V for 89LV51) GNDpin 20: ground XTAL1 , XTAL2pins 19,18 RSTpin 9reset (active high)
Types of Memory
FFFFh
External
DATA
8051 Chip
Internal RAM
SFRs
Internal code Memory
(EEPROM)
FFFFh
External
CODE
ROM
Types of Memory
External Code Memory (64k) External RAM Data Memory (64k) Internal Code Memory 4k,8k,12k,20k ROM, EPROM, EEPROM Internal RAM First 128 bytes: 00h to 1Fh Register Banks 20h to 2Fh Bit Addressable RAM 30 to 7Fh General Purpose RAM Next 128 bytes: 80h to FFh Special Function Registers
Memory Arrays
RAM (Volatile) Read from and write to RAM Used for Data and Program Storage ROM (Non volatile) Only read from ROM Used for Program Storage only
Also store Constant data.
Memory Arrays
Two major types Volatile Data are lost when power is removed E.g. SRAM Static Random Access Memory DRAM Dynamic Random Access Memory Generically referred to as RAM (Random Access Memory) Although non-volatile RAM exists as well Non-Volatile Data are retained when power is removed E.g. EEPROM Electrically Erasable Programmable Read Only Memory EPROM - Erasable Read Only Memory Generically referred to as ROM (Read Only Memory)
The ALE pin is used for de-multiplexing the address and data by connecting to the G pin of the 74LS373 latch.
Bank 3
18 17
Bank 2
10 0F
Bank 1
08 07 06 05 04 03 02 01 00 R7 R6 R5 R4 R3 R2 R1 R0
Bank 0
2C
2B 2A 29 28 27 26 25 24 23 22 21 20 0F 07 06 05 04 03 02 01 1A 10 08 00
89S52 chip
8K bytes of Flash (ROM) 256 bytes of RAM 32 I/O lines (4 ports -8bits per port) Three 16-bit timer/counters Full duplex serial port
Machine cycle
Machine Cycle Freq.=1/12 XTAL Find the machine cycle for
(a) XTAL = 11.0592 MHz (for 89s52)
(b) XTAL = 16 MHz.
Solution:
(a) 11.0592 MHz / 12 = 921.6 kHz; machine cycle = 1 / 921.6 kHz = 1.085 s
(b) 16 MHz / 12 = 1.333 MHz; machine cycle = 1 / 1.333 MHz = 0.75 s
8051 Clock and Instruction Cycle In 8051, one instruction cycle consists of twelve (12) clock cycles. Instruction cycle is sometimes called as Machine cycle by some authors.
Power-On Reset
Vcc
31 10 uF 30 pF
EA/VPP X1
X2 RST 9
10 K
Timer
TMOD SFR
TCON SFR