Micro Lec Note1
Micro Lec Note1
Micro Lec Note1
Spring 2005
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-1
Books
The Z80 Microprocessor , Hardware , Software
Author: Burry B. Brey Translator: Hossein Nia Publisher: Astane Ghodse Razavi(Beh Nashr
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-2
Books
Microcompiuter and Microprocessor : the 8080
Publisher: Nass Pub.Date: 1381 Edition Turn: 3 ISBN: 964-6264-43-4-3 Pages: 719 Author: John E . UffenbeckTranslator: Mahmmod Dayani
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-3
Books
The 80x86 IBM PC and compatible computers (Design and interfacing of the
Publisher: Baghani Pub.Date: 1379 Edition Turn: 2 ISBN: 964-91532-3-3 Pages: 760 Author: Mohammad Ali . Mazidi Janice Gillispie . MazidiTranslator: Dr. Sepidnam
hsabaghianb @ kashanu.ac.ir Microprocessors 1-4
Books
Microcontroller 8051 Publisher: Baghani Pub.Date: 1380 ISBN: 964-7343-00-0 Pages: 380 Author: Mohammad ali Mazidi Jonis Glispi MazidiTranslator: Dr. Sepidnam
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-5
Books
The 8051 Microcontroller Publisher: Baghani Pub.Date: 1380 Publishing Turn: 5 Edition Turn: 3 ISBN: 964-91532-2-5 Pages: 383 Author: Iscott Makenzi Translator: Rezaei Nia ,Darbandi Azar
hsabaghianb @ kashanu.ac.ir Microprocessors 1-6
Intruduction
Microprocessor (uP)(MPU)
A uP is a CPU on a single chip. Components of CPU ALU, instruction decoder, registers, bus control circuit, etc. small computer uP + peripheral I/O + memory specifically for data acquisition and control applications u-Computer on a single chip of silicon
Microprocessors 1-7
Micro-computer (u-Computer)
Microcontroller (uC)
hsabaghianb @ kashanu.ac.ir
uP vs. uC
A uP
only is a single-chip CPU bus is available RAM capacity, num of port is seletable RAM is larger than ROM (usually)
A uC
contains a CPU and RAM,ROM ,Prepherals, I/O port in a single IC internal hardware is fixed Communicate by port ROM is larger than RAM (usually) Small power consumption Single chip, small board Implementation is easy Low cost
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-8
uP vs. uC cont.
Applications
uCs are suitable to control of I/O devices in designs requiring a minimum component uPs are suitable to processing information in computer systems.
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-9
uP vs. uC cont.
uC is easy to use and design.
Only single chip can be a complete system interfacing to other devices, for example, motors, displays, sensors, and communicate with PC.
In contrast, similar system that builds from uP would require a lot of additional units,
such as RAM, UART, I/O , TIMER and etc.
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-10
uC is a Reusable Hardware
Logic circuit provides limited function for one single design. In order to change circuits functionality, we need to redesign the circuits. uC can reprogram and change functionality of every port, input to output or digital to analog on the fly.
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-11
uCs
Many uCs are existing right now.
8051, 68HC11, MSP430, ARM series, and etc.
What is the main difference between RISC/CISC? Does it make any difference to our application?
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-12
P used to sequence executions of instructions that is in memory uP Fetch , Decode , and Execute the instruction The internal architecture of the microprocessor is complex.
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-13
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-14
Microcomputers
All Microcomputers consist of (at least) :
1. Microprocessor Unit (MPU) 2. Program Memory (ROM) 3. Data Memory (RAM) 4. Input / Output ports 5. Bus System (and Software)
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-15
Microcomputers
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-16
Bus
A Bus is a common communications pathway used to carry information between the various elements of a computer system The term BUS refers to a group of wires or conduction tracks on a printed circuit board (PCB) though which binary information is transferred from one part of the microcomputer to another
The individual subsystems of the digital computer are connected through an interconnecting BUS system.
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-18
Bus
There are three main bus groups
ADDRESS BUS DATA BUS CONTROL BUS
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-19
Data Bus
The Data Bus carries the data which is transferred throughout the system. ( bi-directional) Examples of data transfers
Program instructions being read from memory into MPU. Data being sent from MPU to I/O port Data being read from I/O port going to MPU Results from MPU sent to Memory
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-20
Address Bus
An address is a binary number that identifies a specific memory storage location or I/O port involved in a data transfer The Address Bus is used to transmit the address of the location to the memory or the I/O port. The Address Bus is unidirectional ( one way ): addresses are always issued by the MPU.
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-21
Control Bus
The Control Bus: is another group of signals whose functions are to provide synchronization ( timing control ) between the MPU and the other system components.
Control signals are unidirectional, and are mainly outputs from the MPU. Example Control signals
RD: read signal asserted to read data into MPU WR: write signal asserted to write data from MPU
hsabaghianb @ kashanu.ac.ir Microprocessors 1-22
Main memory
The duties of the memory are :
To store programs To provide data to the MPU on request To accept result from the MPU for storage
ROM : read only memory. Contains program (Firmware). does not lose its contents when power is removed (Non-volatile) RAM: random access memory (read/write memory) used as variable data, loses contents when power is removed volatile. When power up will contain random data values
Microprocessors 1-23
hsabaghianb @ kashanu.ac.ir
Read-Only Memory
uP can read instructions from ROM quickly Cannot write new data to the ROM ROM remembers the data, even after power cycled Typically, when the power is turned on, the microprocessor will start fetching instructions from the still-remembered program in ROM (bootstrap )
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-24
Available ROMs
Masked ROM or just ROM PROM or programmable ROM(once only) EPROM (erasable via ultraviolet light) Flash (can be erased and re-written about 10000 times, usually must write a whole block not just 1 byte or 2 bytes, slow writing, fast reading) EEPROM (electrically erasable read-only memory, also known as EEROMboth reading and writing are very slow but can program millions of timesuseless for storing a program but good for say configuration information.
hsabaghianb @ kashanu.ac.ir Microprocessors 1-25
ROM
m+1 bit Address
A0 A1 A2 Am
D0 D1 D2
Capacity :
m 1
2m1 (n 1)
ROM PROM EEPROM
Dn
OE : Output Enable
CE (CS )
CE
OE
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-26
D0-Dn
CE
OE
OE falls to data valid Addr valid to data valid
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-27
27XX EPROM
U3 10 9 8 7 6 5 4 3 25 24 21 23 2 22 27 20 1 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 OE PGM CE VPP O0 O1 O2 O3 O4 O5 O6 O7 11 12 13 15 16 17 18 19
U1 8 7 6 5 4 3 2 1 23 22 19 20 18 21 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 OE CE VPP O0 O1 O2 O3 O4 O5 O6 O7 9 10 11 13 14 15 16 17
16 kbit 2 kbyte
2716
2732
32 kbit 4 kbyte
2764
64 kbit 8 kbyte
27XXX EPROM
U7
12 11 10 9 8 7 6 5 27 26 23 25 4 28 29 3 2 24 31 22 1
D0 D1 D2 D3 D4 D5 D6 D7
13 14 15 17 18 19 20 21
27128
27256
27512
27010
28XX E2PROM
12 11 10 9 8 7 6 5 27 26 23 25 4 28 29 3 2 24 31 22 32 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 A16 OE WE CE VCC D0 D1 D2 D3 D4 D5 D6 D7 13 14 15 17 18 19 20 21
8 7 6 5 4 3 2 1 23 22 19 20 21 18 24
A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 OE WE CE VCC
9 10 11 13 14 15 16 17
10 9 8 7 6 5 4 3 25 24 21 23 2 22 27 20 28
A0 I/O0 A1 I/O1 A2 I/O2 A3 I/O3 A4 I/O4 A5 I/O5 A6 I/O6 A7 I/O7 A8 A9 RDY /BUSY A10 A11 A12 OE WE CE VCC
11 12 13 15 16 17 18 19 1
10 9 8 7 6 5 4 3 25 24 21 23 2 26 1 22 27 20 28
D0 D1 D2 D3 D4 D5 D6 D7
11 12 13 15 16 17 18 19
12 11 10 9 8 7 6 5 27 26 23 25 4 28 29 3 2 30 1 24 31 22 32
A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 A16 A17 A18 OE WE CE VCC
D0 D1 D2 D3 D4 D5 D6 D7
13 14 15 17 18 19 20 21
2816
16 kbit 2 kbyte
64 kbit 8 kbyte
2864
28256
256 kbit 32 kbyte
28010
28040
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-30
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-31
RAM(Static)
A0 A1
m+1 bit Address
D0 D1 D2
A2 Am
Capacity :
m 1
2m1 (n 1)
RAM
Dn
CS
WR
RD
Microprocessors 1-32
Session 2
Microprocessors History Data width 8086 vs 8088 8086 pin description Z80 Pin description
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-33
Microprocessors
Microprocessors come in all kinds of varieties from the very simple to the very complex Depend on data bus and register and ALU width uP could be 4-bit , 8-bit , 16-bit, 32-bit , 64-bit We will discuss two sample of it
Z80 as an 8-bit uP and 8086/88 as an 16-bit uP
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-34
History
Company 4 bit 4004 4040 8 bit 8008 8080 8085 Z80 6800 6802 6809 16 bit 8088/6 80186 80286 Z8000 Z8001 Z8002 68006 68008 68010 68020 68030 68040
Microprocessors 1-35
intel
zilog
Motorola
hsabaghianb @ kashanu.ac.ir
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-36
8086 vs 8088
Only external bus of 8088 is 8_bit
U? 33 22 19 21 18 MN READY CLK RESET INTR AD0 AD1 AD2 AD3 AD4 AD5 AD6 AD7 AD8 AD9 AD10 AD11 AD12 AD13 AD14 AD15 A16/S3 A17/S4 A18/S5 A19/S6 BHE/S7 DEN DT/R M/IO HLDA HOLD NMI TEST 8086MIN RD WR ALE INTA 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 39 38 37 36 35 34 26 27 28 32 29 25 24 30 31 17 23 HLDA HOLD NMI TEST 8088MIN 33 22 19 21 18 U? MN READY CLK RESET INTR AD0 AD1 AD2 AD3 AD4 AD5 AD6 AD7 A8 A9 A10 A11 A12 A13 A14 A15 A16/S3 A17/S4 A18/S5 A19/S6 SSO DEN DT/R IO/M RD WR ALE INTA 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 39 38 37 36 35 34 26 27 28 32 29 25 24
30 31 17 23
8086
8088
Microprocessors 1-37
hsabaghianb @ kashanu.ac.ir
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-38
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-39
RD (output) : When Low, uP is performing a read operation WR (output) : When Low, uP is performing a write operation ALE (output) : Address Latch Enable , Active High Provided by uP to latch address When HIGH, uP is using AD0..AD7, A19/S6, A18/S5, A17/S4, A16/S3 as address lines
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-40
Z - 80 CPU
Address Bus
Data Bus
6 11 29
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-41
D7-D0 :
Data Bus (input/output, active high, 3-state). Used for data exchanges with memory, I/O and interrupts.
RD:
Read (output, active Low, 3-state) indicates that the CPU wants to read data from memory or I/O
WR:
Write (output, active Low, 3-state) indicates that the CPU data bus holds valid data to be stored at the addressed memory or I/O location.
hsabaghianb @ kashanu.ac.ir Microprocessors 1-42
M1
Machine Cycle One (output, active Low). Together with MREQ indicates opcode fetch cycle Together with IORQ indicates an Int Ack cycle
RFSH
Refresh (output, active Low). Together with MREQ indicates refresh cycle. Lower 7-bits address is refresh address to DRAM
hsabaghianb @ kashanu.ac.ir Microprocessors 1-43
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-44
Z80 CPU
8
INTERNAL DATA BUS (8 BIT)
B U F F E R F F'
DATA BUS
MUX
INSTRUCTION REGISTER
W'
Z'
B D H
C E L
ACT
DECODER
CONTROLLER SEQUENCER
ALU
PC k k 16
INTERNAL ADDRESS BUS (16 BIT)
CONTROL SECTION
B U F F E R
ADDRESS BUS
13
INTERNAL CONTROL BUS
B U F F E R
CONTROL BUS
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-47
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-48
Register Set
A : Accumulator Register F : Flag register Two sets of six general-purpose registers
D E H L)
The Alternative registers (A F B C D E H L) not visible to the programmer but can access via:
EXX (BC)<->(BC') , (DE)<->(DE') , (HL)<->(HL') EX AF, AF (AF)<->(AF') what is this instruction useful for?
Microprocessors 1-49
hsabaghianb @ kashanu.ac.ir
Register Set(cont)
4 16-bit registers hold memory address (pointers)
index registers (IX) and (IY) are 16-bit memory pointers 16 bit stack pointer (SP) Program counter (PC)
Flag Register
7 6 5 4 3 2 1 0
S Z X H X
S Z H P V N C
P V
N C
Sign Flag (1:negativ)* Zero Flag (1:Zero) Half Carry Flag (1: Carry from Bit 3 to Bit 4)** Parity Flag (1: Even) Overflow Flag (1:Overflow)* Operation Flag (1:previous Operation wassubtraction)** Carry Flag (1: Carry from Bit n-1 to Bit n, with n length of operand)
ADD ADC
hsabaghianb @ kashanu.ac.ir
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-53
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-54
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-55
The R register
Is increased at every first machine cycle (M1). Bit 7 of it is never changed by this; only the lower 7 bits are included in the addition. So bit 7 stays the same Bit 7 can be changed using the LD R,A instruction. LD A,R and LD R,A access the R register after it is increased R is often used in programs for a random value, which is good but of course not truly random. the block instructions decrease the PC with two, so the instructions are re-executed.
hsabaghianb @ kashanu.ac.ir Microprocessors 1-56
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-57
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-58
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-59
IO read/write cycle
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-61
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-63
M1 Refresh Cycle
Takes 4T to 6Ts Z80 includes built in circuitry for refreshing DRAM This simplifies the external interfacing hardware DRAM consists of MOS transistors, which store Information as capacitive charges; each cell needs to be periodically refreshed During T3 and T4 (when Z80 is performing internal ops), the low order address is used to supply a 7-bit address for refresh
hsabaghianb @ kashanu.ac.ir Microprocessors 1-64
Wait Signal
the Z80 samples the wait signal during T2 if low then Z80 adds wait states to extend the machine cycle used to interface memories with slow response time Slow memory is low cost
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-65
Interrupts
There are two types of interrupts: non mask-able (NMI)
Could not be masked Jump to 0066H of memory
mask-able(INT)
Has 3 mode Can be set with the IM x Instruction IM 0 sets Interrupt mode 0 IM 1 sets Interrupt mode 1 IM 2 sets Interrupt mode 2
hsabaghianb @ kashanu.ac.ir Microprocessors 1-66
Interrupt Modes
Mode 0:
An 8 bit opcode is Fetched from Data BUS and executed The source interrupt device must put 8 bit opcode at data bus 8 bit opcode usually is RST p instructions
Mode 1:
A jump is made to address 0038h No value is required at data bus
Mode 2:
A jump is made to address (register I 256 + value from interrupting device that puts at bus) I is high 8 bit of interrupt vector Value is low 8 bit of interrupt vector
hsabaghianb @ kashanu.ac.ir Microprocessors 1-67
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-68
hsabaghianb @ kashanu.ac.ir
Addressing Modes
Immediate Immediate Extended Modified Page Zero Addressing (rst p) Relative Addressing
Jump Relative (2 byte) One Byte Op Code 8-Bit Twos Complement Displacement (A+2)
Extended Addressing
Absolute jump One byte opcode 2 byte address
Indexed Addressing
(Index Register + Displacement) (IX+d) 2 byte opcode 1 byte displacement
hsabaghianb @ kashanu.ac.ir Microprocessors 1-70
Addressing Modes(cont.)
Register Addressing
LD C,B
Implied Addressing
Op Code implies other operand(s) ADD E
Bit Addressing
set, reset, and test instructions. SET 3,A RES 7,B
hsabaghianb @ kashanu.ac.ir Microprocessors 1-71
Address Bus
Z - 80 CPU
Out In
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-72
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-73
D7~D0
D7~D0
RAM 64 kb A15~A0
A15~A0
Z80 CPU
RD WR
RD
WR CS
MREQ
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-74
RAM 32 kb A14~A0
A14~A0
Z80 CPU
RD WR
RD
WR CS
A15
MREQ
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-75
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-76
D7~D0
RAM 32 kb
D7~D0
RAM 32 kb
A14~A0
A14~A0
RD
WR CS
A14~A0
RD
WR CS
Z80 CPU
RD WR
A15
MREQ
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-77
D7~D0
D7~D0 ROM 32 kb
D7~D0
RAM 32 kb
A14~A0
A14~A0
OE
CS
A14~A0
RD
WR CS
Z80 CPU
RD WR
A15
MREQ
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-78
D7~D0
D7~D0
D7~D0
D7~D0
RD
WR CS
RD
WR CS
RD WR
hsabaghianb @ kashanu.ac.ir
A14 A15
MREQ
En S0 S1
Microprocessors 1-79
AA AA 11 11 54 32
00 00
AAAA 7654
0000
AAAA 3210
0000
Memory Chip
ROM RAM1
3FFFh
4000h 7FFFh 8000h BFFFh C000h FFFFh
hsabaghianb @ kashanu.ac.ir
00 11
01 00 01 11 10 00 10 11 11 00 11 11
1111
0000 1111 0000 1111 0000 1111
1111
0000 1111 0000 1111 0000 1111
1111
0000 1111 0000 1111 0000 1111
RAM2
RAM3
Microprocessors 1-80
Memory Map
Represents the memory type
Address area of each memory chip Empty area
D7~D0 D7~D0 ROM 16 kb A13~A0 A13~A0 A13~A0
CS
0000h
3FFFh 4000h 7FFFh
RAM 16 kb A13~A0
ROM
16k
RAM1
16k
D7~D0 RAM 16 kb
D7~D0
OE
RD
WR CS
RD
WR CS
RD
WR CS
RAM2
16k
RD WR
MREQ
En S0 S1
RAM3
16k
hsabaghianb @ kashanu.ac.ir
A14 A15
FFFFh
Microprocessors 1-81
Memory Map
Empty Area cannt write and read
Read op. returns FFh value (usualy) Write op. cannt store any value on it
0000h
3FFFh 4000h
ROM
Empty
D7~D0 D7~D0 ROM 16 kb A13~A0 A13~A0 A13~A0
CS
D7~D0 RAM 16 kb
OE
RD
WR CS
RD
WR CS
RAM2 RAM3
RD WR
hsabaghianb @ kashanu.ac.ir
A14 A15
MREQ
En S0 S1
FFFFh
Microprocessors 1-82
Memory Map
Empty Area cannt write and read
Read op. returns FFh value (usualy) Write op. cannt store any value on it
0000h
3FFFh 4000h
ROM
Empty
D7~D0 D7~D0 ROM 16 kb A13~A0 A13~A0 A13~A0
CS
D7~D0 RAM 16 kb
OE
RD
WR CS
RAM
RD WR
hsabaghianb @ kashanu.ac.ir
A14 A15
MREQ
En S0 S1
FFFFh
Microprocessors 1-83
Partial Decoding
When some of the address lines are connected the memory/device to perform selection Using this type of decoding results into roll-over addresses (fold back or shading). roll-over address : any memory location has more than one address
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-84
Partial Decoding
A15~A12 has no connection Then doesnt play any role in addressing What is the Memory and Address Bit map?
D7~D0
D7~D0
RD
WR CS
Z80 CPU
RD WR
MREQ
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-85
Partial Decoding
Every memory location has more than one address For example first RAM location has addresses: 0000h 1000h 2000h 3000h Roll-over Address
. .
F000h FFFFh
RAM
F000h
D7~D0
D7~D0
A15 to A0 (HEX)
X000h
AAAA 7654
AAAA 3210
Memory Chip
RAM 4 kb
A11~A0
A15~A12
A11~A0
RD
WR CS
0000
0000
XFFFh
xxxx
1111
1111
1111
RAM
Z80 CPU
RD WR
MREQ
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-86
Partial Decoding
A12 only connected to RAM A13 has no connection What is the memory map?
D7~D0
D7~D0 ROM 4 kb
D7~D0
RAM 8 kb
A12~A0 A13
A11~A0
A12~A0
CS
OE
RD
WR CS
Z80 CPU
A15 A14
hsabaghianb @ kashanu.ac.ir
RD WR
MREQ
Microprocessors 1-87
Partial Decoding
8 roll-over address for ROM 4 roll-over address for RAM
D7~D0
D7~D0
D7~D0
ROM 4 kb
A12~A0 A11~A0 A12~A0
RAM 8 kb
AAAA 7654
AAAA 3210
Memory Chip
OE
CS
RD WR CS
0000
0000
0xxx
X0x0 X0x1
1111
0000 1111
1111
0000 1111
1111
0000 1111
ROM RAM
hsabaghianb @ kashanu.ac.ir
A15 A14
MREQ
Microprocessors 1-88
Partial Decoding
D7~D0 D7~D0 D7~D0
0000h
0000h
RAM
1FFFh 2000h
0FFFh
Conflict
1000h 1FFFh 2000h 2FFFh 3000h 3FFFh 4000h 4FFFh 5000h 5FFFh 6000h 6FFFh 7000h 7FFFh F000h
RAM
RAM 8 kb
3FFFh 4000h
ROM 4 kb
A12~A0 A11~A0 A12~A0
OE
CS
RD WR CS
5FFFh 6000h
hsabaghianb @ kashanu.ac.ir
A15 A14
MREQ
7FFFh 8000h
RAM AAAA 1198 10 0000 1111 0000 1111 AAAA 7654 AAAA 3210 Memory Chip
4k
9FFFh A000h
ROM
8k
RAM
FFFFh
Microprocessors 1-89
Partial Decoding
D7~D0 D7~D0 D7~D0
0000h
1FFFh 2000h
ROM 4 kb
A12~A0 A11~A0 A12~A0
RAM 8 kb
3FFFh 4000h
OE
CS
RD WR CS
5FFFh 6000h
RAM
Conflict
RAM
hsabaghianb @ kashanu.ac.ir
A15 A14
MREQ
7FFFh 8000h
AAAA 7654
AAAA 3210
Memory Chip
4k
9FFFh A000h
BFFFh C000h
ROM
8k
RAM RAM
DFFFh E000h
RAM
FFFFh
FFFFh
Microprocessors 1-90
A12~A0
ROM
A12~A0 D7~D0
2764 EPROM 8k8
0010
0111
1111
1111
RAM
OE
CE
7421
A10~A0 A10~A0 D7~D0
6116 RWM 2k8
74138
A15 A14
MREQ
Y3 Y4 Y5 Y6 Y7
2000h-27FFh
G2A G2B G1
RD WR CS
RD WR
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-91
Partial decoding
AAAA 1111 5432 0000 0001 001x AAAA 1198 10 0000 1111 x000 AAAA 7654 0000 1111 0000 AAAA 3210 0000 1111 0000 Memory Chip
A12~A0
ROM
A12~A0 D7~D0
2764 EPROM 8k8
001x
x111
1111
1111
RAM
OE
CE
A10~A0
74138
MREQ
Y3 Y4 Y5 Y6 Y7
A10~A0 D7~D0
6116 RWM 2k8
G2A G2B G1
GND VCC
RD WR CS
RD WR
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-92
Din
A11-A0 A11~A0
2147 RWM 4k1
Din
A11-A0 A11~A0
2147 RWM 4k1
Din
A11~A0 A11-A0
2147 RWM 4k1
Dout
Dout
Dout
WR / RD
CS
WR / RD
CS
WR / RD
CS
WR / RD
CS
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-93
OE
CE
RD
A15 A14
C B A
Y0 Y1 Y2
A13
74138
MREQ
Y3 Y4
A11-A0
Din
A11~A0 Dout
2147 RWM 4k1
Din
A11-A0 A11~A0 Dout
2147 RWM 4k1
Din
A11-A0 A11~A0 Dout
2147 RWM 4k1
G2A G2B G1
WR
Y5 Y6 Y7
WR
GND VCC
WR / RD CS
WR / RD CS
WR / RD CS
RD
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-94
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-95
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-96
+5V INT -
DMA
IEI RDY
INT -
INT -
IEO
W/RDYB -
Z80 CPU
+5V IEI
CTC
ZC/TO1 ZC/TO2
SIO
TxCA TxCB RxCA RxCB -
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-97
Content of A is data
r is a data register
Data is transfered to A
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-99
OUT (03), A
D0 Q0 D1 Q1 D2 Q2 D3 Q3 D4 74LS373 Q4 D5 Q5 D6 Q6 D7 Q7 LE OE
Z80 CPU
hsabaghianb @ kashanu.ac.ir
WR IORQ
IOWR A AAA AA AA 7 654 32 10
Microprocessors 1-100
IN A, (02)
Y0 A0 Y1 A1 Y2 A2 Y3 A3 Y4 74LS244 A4 Y5 A5 Y6 A6 Y7 A7 G1 G2
5V
Z80 CPU
hsabaghianb @ kashanu.ac.ir
RD IORQ
IORD AAAA AAAA 7654 3210
Microprocessors 1-101
LE
IOR IOW
OE
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-102
What is this?
AAAAAAAAAAAAAAAAIOW 1 1 1 1 1 19 8 7 6 5 4 32 1 0 5 432 10
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-103
D7-D0
74LS245
A7-A0
Q7 - Q0
D7 - D0 OE LE
74LS373
Q7 - Q0
A15 - A8
D7 - D0 GND OE LE
A15-A8
8088
A19/S6 - A16/ S3
74LS373
Q7 - Q4 Q3 - Q0
D7 - D4 D3 - D0 GND OE LE
A19-A16
ALE RD IO / M
74LS373
MEMR MEMW
WR
IOR IOW
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-104
Minimum Mode
220 bytes or 1MB memory
D7 - D0
D7 - D0
A19 - A0
A19 - A0
1 MB Memory
RD
WR
CS
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-105
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-106
Minimum Mode
512 kB memory
D7 - D0 A19 A18 - A0
D7 - D0
1) 2)
RD
WR
CS
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-107
00000h 7FFFFh
A19 is not connected to the memory so even if the 8088 microprocessor outputs a logic 1,the memory cannot see it. A19=0 is the same as A19=1 for Memory
512k Mem
80000h FFFFFh
512k Mem
Connect to cs
00000h 7FFFFh
512k Mem
80000h FFFFFh
Empty
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-108
2 512 kB memory
D7 - D0 A19 A18 - A0
MEMR
D7 - D0
512 kB RAM1
A18 - A0 RD WR
MEMR MEMW
MEMW
CS
D7 - D0
512 kB RAM2
A18 - A0
MEMR MEMW
RD WR
CS
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-109
2 512 kB memory
What are the memory locations of two consecutive 512KB (219 bytes) Memory?
AAAA 1111 9876 AAAA 1111 5432 AAAA 1198 10 AAAA 7654 AAAA 3210 Memory Chip
00000h
512k RAM1
7FFFFh 80000h
0000
0111 1000
0000
1111 0000
0000
1111 0000
0000
1111 0000
0000
1111 0000
ROM RAM
FFFFFh
512k RAM2
1111
1111
1111
1111
1111
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-110
A17
:
A0 D7
:
D0 RD WR
256KB #4
CS
A17
:
A0 D7
:
A0 D7
:
D0 MEMR MEMW
D0 RD WR CS A17
:
256KB #3
A0 D7
:
D0 RD WR CS A17
:
256KB #2
A0 D7
:
D0 RD WR CS
256KB #1
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-111
A17
:
A0 D7
:
D0 RD WR CS A17
:
256KB #4
A0 D7
:
A0 D7
:
D0 MEMR MEMW
D0 RD WR CS A17
:
256KB #3
A0 D7
:
D0 RD WR CS A17
:
256KB #2
A0 D7
:
D0 RD WR CS
256KB #1
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-112
Memory Chip
RAM#1 RAM#2 RAM#3 RAM#4
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-113
A12
:
A0 D7
:
D0 RD WR
CS
8KB #?
A0 D7
:
D0 MEMR MEMW
: :
A12
:
A0 D7
:
D0 RD WR CS A12
:
8KB #2
A0 D7
:
D0 RD WR CS
8KB #1
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-114
A12
:
A0 D7
:
D0 RD WR
CS
8KB #128
A0 D7
:
D0 MEMR MEMW
: :
A12
:
A0 D7
:
D0 RD WR CS A12
:
8KB #2
A0 D7
:
D0 RD WR CS
8KB #1
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-115
A12
:
A0 D7
:
D0 RD WR CS
8KB #128
A0 D7
:
D0 MEMR MEMW
: :
A12
:
A0 D7
:
D0 RD WR CS A12
:
8KB #2
A0 D7
:
D0 RD WR CS
8KB #1
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-116
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-117
OE
CE
D7~D0
A14
C B A
7408
Y0 Y1
RD
A13
A12
Y2
A10~A0
74138
MREQ
Y3
A10~A0 D7~D0
6116 RWM 2k8
Y4
G2A G2B G1 Y5 Y6 Y7
74244 input
G1G 2
A15
VCC
RD WR CS
RD WR
hsabaghianb @ kashanu.ac.ir
Microprocessors 1-118