0% found this document useful (0 votes)
102 views19 pages

Slide-2 (8086 Basics and Memory Banking)

The document discusses embedded systems and interfacing topics including binary, hexadecimal, memory banking, and microprocessor basics like address bus, data bus, and control bus. Memory banking allows a microprocessor to access two memory locations simultaneously using its multiplexed address and data lines.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
102 views19 pages

Slide-2 (8086 Basics and Memory Banking)

The document discusses embedded systems and interfacing topics including binary, hexadecimal, memory banking, and microprocessor basics like address bus, data bus, and control bus. Memory banking allows a microprocessor to access two memory locations simultaneously using its multiplexed address and data lines.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Embedded Systems and

Interfacing
EEE 315
Fahim Mahmud
Assistant Professor
Dept. of EEE
CUET
Class outline

 Binary and hexadecimal


 8086 basics
 Memory banking
Binary and hexadecimal

 Literally everything in a microprocessor and microcontroller is in binary.


 However, while interacting with the microprocessor, hexadecimal instead
of decimal system is used.
 In decimal system, we have 0 to 9, 10 digits in total.
 So, we need at least 4 bits to represent 10 digits. But 4 bits = 2^4 = 16
combinations. Hence, 6 combinations are unused.
 If we develop a new system that makes use of these remaining 6
combinations as well, we can save a lot of memory.
 That’s where hexadecimal system comes into picture.
 In hexadecimal system, we have 0 to 9, then from A to F.
 For example, to store 12 (decimal), we store 00010010 (8 bits) in memory.
But in hexadecimal, 12 is C and for that, we store 1100 (4 bits).
Powers of 2

 2^10 = 1024 = 1K
 2^20 = 1M
 2^30 = 1G
 2^40 = 1T
 2^24 = 2^4*2^20 = 16*1M = 16M
 2^35 = 2^5*2^30 = 32*1G = 32G
 8 bit number: 00H (smallest), FFH(highest)
 16 bit number: 0000H (smallest), FFFFH (highest)
 Remembering the above will make your life easier in this subject.
Basic organization of computer
What does μP do?

 It fetches instructions.
 It decodes instructions.
 It executes instructions.
System bus

 Bus means a set of lines used for transferring information.


 One line can transfer 1 bit at a time.
 Bus size refers to bit size. 20 bit bus means it has 20 lines.
 Any microprocessor has 3 types of buses: address bus, data bus and control
bus.
 An important point to remember: Read and write operations are from μP’s
point of view. μP reads and writes.
Address bus

 Size of address bus determines the memory size that a μP can access.
 1 bit address bus can uniquely identify 2 locations, 2 bit address bus can
uniquely identify 4 locations, n-bit address bus can uniquely identify 2^n
locations.
 Each memory location carries 1 byte (8 bits).
 So, n-bit address bus = 2^n byte memory.
 8086 μP has 20 bit address bus. Hence, it can access 2^20 = 1MB memory.
 80386 has 32 bit address bus. So, it has 2^32 = 4GB memory.
 Larger memory, however, doesn’t mean higher speed.
 Address bus is unidirectional, meaning only μP gives address.
Data bus

 As the name suggests, data bus transfers data from and to the μP.
 Hence, it’s a bidirectional bus.
 Size of data bus determines the speed of μP.
 8086 has 16 bit data bus. It means that it can read or write 16 bits (2 bytes)
in one instruction cycle.
Control bus

 There are many types of control signals, two most important ones are read
and write signals.
 RD’ and WR’ => bar/prime means they are active low signals.
 M/IO’ => it tells whether it’s a memory based operation or a I/O based
operation.
Memory banking

 Important: Lower bytes are stored in lower address, higher bytes are stored
in higher address.
 1 memory location = 1 byte (8 bits)
 8086 has 16 bit data bus, so it can carry 16 bits at a time.
 But it can select/give only a single address and a single address/location
carries 1 byte. So, half of its data bus is being unused.
 Solution?
 Make each memory location bigger? Then for smaller instructions (smaller
bytes), remaining portion of a location will be wasted.
 That’s where the concept of memory banking comes into play.
Memory banking

 One memory location should be as small as possible (8 bytes, a standard


size for most instructions)
 If you have 16-bit memory location, you make it compulsory to work on 16-
bit data to avoid memory wastage.
 If you have memory banks, you have the facility but don’t make it
compulsory to work with 16-bit data.
 Memory banking is the idea of dividing the whole available/accessible
memory into two separate banks. (For higher μP, we need more banks
because they have larger data bus.)
Memory banking
Memory banking

 Even bank = Lower bank (more familiar term)


 Odd bank = Higher bank (more familiar term)
 Data starting from even location are called aligned data whereas data
starting from odd location are called misaligned data.
 Aligned data can be accessed in 1 cycle but misaligned data cannot.
 Aligned data means corresponding locations in the two banks (first
locations in both banks, second locations in both banks etc. are said to be
aligned.)
 But we are still trying to access data from two locations. μP cannot give two
addresses simultaneously. So?
Memory banking

A A A A A A A A A A A A A A A A A A A A
19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1

8086 has a 20 bit address bus.


Do you notice any pattern above?
Memory banking

 A1-A19 decides which location to select.


 A0 decides which bank to select.
 So, the microprocessor is still generating only one address/location via A1-
A19.
 To select any one of the two banks for a 8-bit operation or both banks for a
16-bit operations, it needs 3 options. To meet 3 options, we need 2 bits (2^2
= 4 options). Select only LB, or only HB, or both banks.
Memory banking
Memory banking

BHE A0 Operation
0 0 R/W 16-bit
0 1 R/W 8-bit from HB
1 0 R/W 8-bit from LB
1 1 Idle

You might also like