Sie sind auf Seite 1von 24

Chapter 2 Microprocessor, Memory and I/O

Three major differences between microprocessors. - The length of the microprocessors data word. - The size of the memory which the microprocessor can directly address. - The speed which the microprocessor can execute instructions. Some of additional architectural differences are: - The number of register available to the programmer. - The different types of register available to the programmer. - The different types of instructions available to the programmer. - The different types of memory addressing modes available to the programmer. - The different types of support circuits available to the system designer. - Compatibility with readily available development, system and applications software.

- Compatibility with hardware development systems. These differences make some microprocessors better for some applications and some other microprocessors better for other applications. Some microprocessors are better because they appeal to the user more than another which might work equally well in the same situation. 2.1 Word Lengths The microprocessor started as a 4-bit device. It has progressed to an 8 bit, a 16 bit, a 32 bit and now a 64 bit device. A microprocessor with a longer word length will solve more problems faster. Therefore, a longer word length should give a better solution to all problems. However, the consideration of product cost is important. The real performance issue is cost, not horse power. In almost every case, the longer the data word, the more the microprocessor and its support components cost. 2.1.1 The 4 bit microprocessor applications

The 4 bit microprocessors are very good for low-cost and simple applications. Students will find the 4 bit microprocessor in - Toy : robots, remote-controlled cars, hand held games - Calculators : financial, scientific, database - Power tool controllers : speed controls, sequencers, measurement devices - Simple : microwave ovens, telephone dialers, smart thermostats, shortwave scanners, TV remote controls - Computer peripherals : keyboard scanners, simple printers, clocks 2.1.2 The 8 bit microprocessor applications - Toys : video games, programmable robots - Complex intelligent product controllers : VCR control and programming, security systems, lighting system controllers - Computer peripherals: video display, higher-speed printers. Modems, plotters, communication controllers.

- Industrial controllers : robotics, processing control, sequence control, machine tool control - Instruments : logic analyzers, communication analyzers, disk drive testers, digital oscilloscopes, smart voltmeters The 16 bit, 32 bit and 64 bit microprocessors are frequency found in graphic oriented CAD and CAM systems. The 32 bit and 64 bit microprocessors feature very fast operation, extreme computing power, and megabytes, or even gigabytes, of main memory-addressing space. 2.2 Addressable Memory The amount of memory addressing capability needed depends on the application you have. Usually, the larger the microprocessors data word, the larger the main memory space it can address. In a simple microprocessor-base system, the program steps are stored in ROM and the variable data is stored in RAM. 2.3 Generalized Microprocessor Unit (MPU)

The microprocessor Unit (MPU) is a programmable logic device with a designed set of instructions. Review: CPU reads/fetches each instruction (one at a time), from memory and performs data manipulation specified by the instruction. It also reads data from input devices, and writes (or sends) data to output devices. There are two categories of MPU communication process and related operations. - MPU (or program) initiated operations - Peripheral (or externally) initiated operations 2.3.1 MPU operation - A group of logic circuits - A set of signals to transfer information - control signals for timing - Clock circuitry Microprocessor Buses and Signals Bus = a group of signal lines activated together to provide information The MPU-initiated operations

1. Memory read : Reads data (binary information) from memory 2. Memory write : Writes data into memory 3. I/O Read : Accepts data from input devices 4. I/O Write : Send data to output devices How does the MPU identify a memory register or an I/O device?
- The MPU identifies each memory register or I/O

by a binary number called an address. How does the MPU inform the peripherals when it is ready to read or write data? - It does by sending out appropriate timing signals called signals before it transfer data. The steps performing MPU operations 1. Identify the memory location or the peripheral with its address. 2. Provide timing or synchronization signal. 3. Transfer binary data. To perform the operations described above, the MPU requires three set of communication buses lines:

1. Address bus: identify the memory location 2. Data bus: transfer data 3. Control lines: timing signals

Address bus

How large is this address? - It depends upon the internal design of microprocessor and available pins on a chip (8, 16, 20, or more bits). Data bus These lines are used to transfer data are bidirectional. The size of the data bus determines how large a binary number can be transferred and

processed at a time. The 8085 and the Z80 have eight data lines and called 8 bit microprocessors. On the other hand, the 8086, the 80286, and the Z8000 have 16 data lines and are called 16 bit microprocessors. Control signals These are individual signal lines generated by the MPU to indicate its operations. The MPU generates a specific signal for each of its four operations - Memory Read - Memory Write - I/O Read - I/O Write These are timing signals that are used to enable, or activate, peripherals. 2.3.2 External Request Signals

Reset: Start again from the beginning.

Interrupt: Stop the ongoing process

temporarily; do something now and then go back to the original process.

too slow to respond to the speed of the MPU, this signal can be used to delay the MPU operations.

Wait: When memory response time is

Bus request: When the MPU operations

are too slow compared to the speed of a peripheral, the peripheral can request the use of the buses. Request Acknowledge Signals The MPU to inform the external peripheral that it

is ready to accept the request. To indicate its response to some of these external requests, the MPU needs additional signals. 2.3.3 Clock Signals and Power Clock Power Ground

The timing is very critical in all its operations. Therefore, the MPU needs circuits that generate clock signals.

2.3.4 Microprocessor Internal Architecture When the microprocessor executes instructions, it does a continuous sequence of fetch, decode, and execute operations. Fetching an instruction The microprocessor places a memory address on

the address bus and reads binary information using the data bus. Therefore, it needs a register that can hold memory addresses and increment these addresses after the fetching is complete, a sort of memory pointer. Decoding an instruction Once an instruction byte is fetched, it needs to be decoded to answer the following:

Is it a complete instruction? If not, how many

more bytes need to be fetched?

What type of operation is required and on

what data? Executing an instruction The type of data manipulation the MPU can perform depends on its internal micro programs, that is, on its instruction set. These operations can be classified as data copy (transfer), arithmetic/logic operations, and decision making. For example, to subtract two numbers, both numbers must be loaded into registers. After the subtraction, it is necessary to indicate whether the result is positive, negative, or zero. This can be indicated by setting or resetting flipflops called flags. 2.3.5 Review of Important Concepts

To communicate with memory and I/O devices, the MPU should have the following six groups of signals: 1. Address bus to send the address of a memory register or an I/O. 2. Data bus to transfer data between the MPU 1. Control signals to identify its operations and provide timing. 2. External Request signal lines to interrupt the MPU operations.

3. Request Acknowledge signals to respond to the requests by peripherals. 4. Clock signals to provide timing and power to operate circuits. To process internally, the MPU should include the following: 1. Instruction Decoder to decode the fetched binary information. 2. Registers to store binary data. 3. Registers as memory pointers for addressing memory registers. 4. ALU to perform arithmetic and logic operations. 5. Flags (flip-flops) to indicate data conditions for decision making. 2.4 Memory

Memory is and essential component of

microcomputer system; it stores binary instructions and data for the microprocessor. They can be classified in two groups: prime (or main) memory and storage memory. The R/W memory is made up of registers,

and each register can use this memory to hold programs and store data. On the other hand, the ROM stores information permanently in the form of diodes. 2.4.1 Flip-Flop or Latch as a Storage Element. What is memory? It is a circuit that can store bits. A flip-flop or latch is a basic element of memory. To write or store a bit in the latch, we need an input data bit and an enable signal.

This latch, which can store one binary bit, is called a memory cell.

Figure shows four latches as a 4 bit Register. The number of bits stored in a register is called a memory word.

The requirements of a memory chip.

1. A memory chip requires address lines to identify a memory register, a chip select CS signal.

2. The number of address lines required is

determined by the number of registers in a chip (2 ) 3. If additional address lines are available in a system, chip select signal is used.
4. The control signal Read ( RD ) enables the output
R buffer. The control signal Write ( W ) enables the n

input buffer.

2.4.2 Memory Map and Address Typically, in an 8- bit microprocessor system, 16 address lines are available for memory. It is capable of identifying 2

(65,536) memory registers, each

register with a 16 bit address. The entire memory addresses can range from 0000 to FFFF in Hex.


2.4.3 How the MPU writes into and Reads from 1. Places the 16 bit address on the address of the memory location where a byte is to be stored. The interfacing logic of the memory chip decodes

the address and selects the memory register to be written into. 2. Places the byte on the data bus. 3. Send the control signal Memory. Write to enable the input buffer of the memory and then stores the byte. To read from memory the step are similar to that of writing into memory, except the order of step 2 and 3. 2. The MPU send the control signal Memory Read to enable the output buffer of the memory chip. 3. The memory chip places the data byte on the data bus, and the MPU reads the data byte

2.5 Input and Output (I/O) Devices

Input/output devices are the means through which the MPU communications with the outside world. The MPU accepts binary data as input from devices such as keyboards and A/D converters and sends data to output devices such as LEDs or printers. There are two different methods by which an MPU can identify I/O devices: o 8 bit address o 16 bit address 2.5.1 I/Os with 8-bit Addresses (PeripheralMapped I/O) The MPU uses eight address lines to identify an

input or an output device. The MPU can identify 256 input and 256 output devices with addresses ranging from 00H to FFH. The steps in communicating with I/O device can be summarized as follows: 1. The MPU places an 8 bit address on the address bus, which is decodes by the external decode logic.

2. The MPU sends a control signal (I/O Read or I/O Write) to enable the I/O device. 3. Data are transferred on the data bus. 2.5.2 I/Os with 16 bit Addresses (Memory-Mapped I/O) The MPU uses 16 address lines to identify an

I/O device; an I/O is connected as if it is a memory register. In memory-mapped I/O, the MPU uses the same control signals (Memory Read or Memory Write) and instructions as there of memory and follows the same steps as when it is accessing a memory register. 2.5.3 How does the system work? In figure above let us assume that the memory address of the first R/W memory location is 8000H and the address of the fan output port is 43H. The example of the two byte instruction that tells the processor to turn on the fan with the address 43H. Memory 8000 Hex Code Code explanation D3 Out put (turn on)



The fan

To execute this one instruction, the MPU performs the following operations.
1. MPU must read the binary code of the out

instruction stored in location 8000H. To read the code D3, the MPU places the address 8000H on the address bus, enables the memory chip by asserting the Memory Read ( MEMRD ) signal, and fetches the code D3H using the data bus. This is called the fetch operation.
2. The code D3H in the instruction decoder and it is

interpreted as a two-byte instruction. The MPU places the next address 8001H on the address bus, asserts the

signal, and fetches the

address 43H. Now it has read the complete instruction, and is ready to execute the instruction. 3. The MPU places the address of the fan output port (43H) on the address bus, sends a byte to

turn on the fan using the data bus, and asserts the IOWR signal to enable the output port.

Chapter 2 Microprocessor, Memory and I/O

2.1 Word Lengths 2.1.1 The 4 bit microprocessor applications 2.1.2 The 8 bit microprocessor applications

2.2 Addressable Memory

2.3 Generalized Microprocessor Unit (MPU) 2.3.1 MPU operation 2.3.2 External Request Signals

2.3.3 Clock Signals and Power 2.3.4 Microprocessor Internal Architecture 2.3.5 Review of Important Concepts 2.4 Memory 2.4.1 Flip-Flop or Latch as a Storage Element.

2.4.2 Memory Map and Address Memory. 2.4.3 How the MPU writes into and Reads from

2.5 Input and Output (I/O) Devices Mapped I/O) I/O)

2.5.1 I/Os with 8-bit Addresses (Peripheral2.5.2 I/Os with 16 bit Addresses (Memory-Mapped 2.5.3 How does the system work?