Unit 1 Intro To Microprocessor
Unit 1 Intro To Microprocessor
Contents
Introductions to microprocessors:.......................................................................................................................1
Application of Microprocessor............................................................................................................................2
Classification of Microprocessor..........................................................................................................................3
Components of a Microprocessor.......................................................................................................................4
Microprocessor System with Bus Organization...................................................................................................4
Introduction to SAP1 and SAP2...........................................................................................................................6
SAP-1 Architecture..........................................................................................................................................6
Instruction Cycle of SAP-1..................................................................................................................................12
SAP-2 Architecture............................................................................................................................................12
Comparison between SAP1 and SAP2............................................................................................................13
Difference between Microprocessor and Microcontroller................................................................................14
Introductions to microprocessors:
A microprocessor is a multipurpose, programmable, clock-driven, register-based electronic
device that reads binary instructions from a storage device called memory, accepts binary data
as input and process data according to those instructions and provides result as output.
These four components work together or interact with each other to perform a given
task; thus, they comprise a system. The physical components of this system are called hardware.
BIT 2ndSem |Microprocessor and Computer Architecture [BIT151] | Unit 1: Page 1
BMC@DC
A set of instructions written for the microprocessor to perform a task is called a program and a
group of programs is called software. Microprocessors may be simple or sophisticated
depending on its applications and it is recognized by various names depending upon the purpose
for which it is designed.
The microprocessor applications are classified primarily into two categories:
o Reprogrammable Systems
In Reprogrammable systems, microprocessor is used for computing and data
processing.
o Embedded Systems
In embedded systems, microprocessor is a part of final product and is not
available for reprogramming to the end user. Examples include the wide range of
products such as washing machine, dishwasher, traffic light controllers, etc.
The microprocessor (also known as CPU), is the brain of all computers and many household
electronic devices. The first microprocessor was the Intel 4004, introduced in 1971. It was not
very powerful; it was primarily used to perform simple mathematical operations.
Application of Microprocessor
The application of microprocessor is of no bound. They can be used virtually anywhere and, in
any field, due to its availability of low cost, low power and small weight. We can find
microprocessor-based systems in traffic light control, automatic testing product etc.…
Some of the application areas are:
o Test Instruments:
Microprocessors are widely used in devices such as signal generators,
oscilloscopes, counters, digital multimeters, x-ray analyzers, frequency
synthesizers, etc. For example: fluke 6010A synthesized signal
generators use 4004 microprocessors.
Oscilloscopes is a type of electronic test instrument that graphically displays
varying signal voltages, usually as a calibrated two-dimensional plot of one or
more signals as a function of time.
Communication:
o Microprocessors are being used in a wide range of communication equipment in
telephone industry, television and satellite communication.
o Railway and air reservation system also uses this technology. LAN and WAN for
communication of vertical information through computer network.
Control:
BIT 2ndSem |Microprocessor and Computer Architecture [BIT151] | Unit 1: Page 2
BMC@DC
o Microprocessor based controllers are available in home appliances such as
microwave oven, washing machine, etc.
o Microprocessors are being used in controlling various parameters like speed,
pressure, temperature, etc...
o These are used with the help of suitable transductions.
Office Automation and Publication:
o Microprocessor based micro-computer with software packages has changed the
office environment.
o Microprocessor based systems are being used for word processing, spreadsheet
operation, storage, etc…
o The microprocessor has revolutionized the publication technology.
Consumer:
o The use of microprocessor in toys, entertainment equipment and home applications
are making them more entertaining and full of features.
o The use of microprocessor is more widespread and popular.
Classification of Microprocessor
The microprocessor is identified with the word size of data.
Example: the ALU can perform a 4-bit data operation at a time these microprocessors is
called as 4-bit microprocessor.
1. 4-bit Microprocessor
BIT 2ndSem |Microprocessor and Computer Architecture [BIT151] | Unit 1: Page 3
BMC@DC
Intel 4004, Intel 4040
2. 8-bit Microprocessor
Intel 8080, 8085, Motorola 6800 (M6800)
3. 16-bit Microprocessor
Intel 8086, 8088
4. 32-bit Microprocessor
Intel 80386, 80387, Pentium
5. 64-bit Microprocessor
Intel Pentium II, III, IV, AMD64, Intel i3, i7, i9
Components of a Microprocessor
Microprocessor is the brain of computer, which does all the work. It is a computer processor that
incorporates all the functions of CPU (Central Processing Unit) on a single IC. Compared to the first
microprocessors, today’s processors are very small but still they have these basic parts right from
the first model −
CPU
Bus
Memory
CPU
CPU is fabricated as a very large scale integrated circuit (VLSI) and has these parts −
Instruction register − It holds the instruction to be executed.
Decoder − It decodes (converts to machine level language) the instruction and sends to the
ALU (Arithmetic Logic Unit).
ALU − It has necessary circuits to perform arithmetic, logical, memory, register and program
sequencing operations.
Register − It holds intermediate results obtained during program processing. Registers are
used for holding such results rather than RAM because accessing registers is almost 10 times
faster than accessing RAM.
Bus
Connection lines used to connect the internal parts of the microprocessor chip is called bus. There
are three types of buses in a microprocessor −
Data Bus − Lines that carry data to and from memory are called data bus. It is a bidirectional
bus with width equal to word length of the microprocessor.
Address Bus − It is a unidirectional responsible for carrying address of a memory location or
I/O port from CPU to memory or I/O port.
Control Bus − Lines that carry control signals like clock signals, interrupt signal or ready
signal are called control bus. They are unidirectional. Signal that denotes that a device is ready
for processing is called ready signal. Signal that indicates to a device to interrupt its process is
called an interrupt signal.
Memory
Microprocessor has two types of memory
RAM − Random Access Memory is volatile memory that gets erased when power is switched
off. All data and instructions are stored in RAM.
a. Address Bus
The address bus is a group of 16 lines generally identified as A0 to A15.
The address bus is unidirectional i.e. bits flow in one direction from the MPU to peripheral
devices.
In a computer system, each peripheral or memory location is identified by a binary number
called an address and the address bus is used to carry a 16-bit address.
The number of wires in address bus signifies the memory size (no. of bytes) that can be
connected to the microprocessor.
If the microprocessor has ‘n’ number of bits (wires) in address bus than the microprocessor
can address 2n bytes memory locations.
Example: If a microprocessor has 16 address lines then, it can address 216=65536(generally
known as 64 K) memory locations.
[1K Memory is determined by rounding off 1024 to the nearest thousand; similarly; 65536 is
rounded off to 64K as aq multiple of 1K]
b. Data Bus
The data bus is a group of eight lines used for data flow.
These lines are bidirectional i.e. data flow in both directions between the MPU and memory
and peripheral devices.
Number of lines in data bus signifies two things:
o First one is, it is called the word size of microprocessor which means no. of bits the
microprocessor can process at a time.
o Second one is, it gives the maximum no. of instruction that the microprocessor can
have.
c. Control Bus
The control bus is comprised of various single lines that carry synchronization signals.
There are not groups of lines like address or data buses but individual lines that provide a
pulse to indicate a MPU operation. The microprocessor generates specific control signals for
every operation such as memory read, I/O read, Memory write or I/O write. These signals are
used to identify a device type with which the MPU intends to communicate.
Program Counter:
The program is stored at the beginning of the memory with the first instruction at binary
address 0000, the second instruction at 0001, the third at address 0010 and so on. The
program counter which is part of the control unit, counts from 0000 to 1111. Its job is to
send to the memory the address of the next instruction to be fetched and executed.
The program counter is reset to 0000 before each computer run. When the computer run
begins, the program counter sends the address 0000 to the memory. The program counter is
BIT 2ndSem |Microprocessor and Computer Architecture [BIT151] | Unit 1: Page 8
BMC@DC
then incremented to get 0001. After the first instruction is fetched and executed, the
program counter sends address 0001 to the memory. Again the program counter is
incremented. After the second instruction is fetched and executed, the program counter
sends address 0010 to the memory. So this way, the program counter keeps track of the next
instruction to be fetched and executed.
The program counter is like someone pointing a finger at a list of instructions saying do this
first, do this second, do this third, etc. This is why the program counter is called a pointer; it
points to an address in memory where the instruction or data is being stored.
The Input and MAR includes the address and data switch registers. Switch registers are part
of input unit, allows us to send 4 address bits and 8 data bits to the RAM.
The memory address register (MAR) is the part of SAP-1 memory. During a computer run,
the address in the program counter is latched in to the MAR. A bit later, the MAR applies this
4-bit address to the RAM where a read operation is performed.
The RAM
The RAM is a 16 X 8 static RAM. We can program the RAM by means of the address and data
switch registers. This allows you to store a program and data in the memory before a
computer run.
During a computer run, the RAM receives 4-bit addresses from the MAR and a read
operation is performed. In this way, the instruction or data word stored in the RAM is placed
on the W bus for use in some other part of the computer.
Instruction Register
The instruction register is the part of the control unit. To fetch an instruction from the
memory the computer does a memory read operation. This places the contents of the
addressed memory location on the W bus. At the same time, the instruction register is set up
for loading on the next positive clock edge. The content of the instruction register are split
into two nibbles. The upper nibble goes directly to the block “Controller – Sequencer”. The
lower nibble is read onto the W bus when needed.
Controller Sequencer
It generates the control signals for each block so that action occurs in desired sequence. CLK
signal is used to synchronize the overall operation of the SAP-1 computer. A 12-bit word
comes out of the Controller- Sequencer block. This control word determines how the
registers will react to the next positive CLK edge.
Accumulator
SAP-1 uses a 2’s complement adder-subtractor. When SU is low, the sum out of the adder-
subtractor is S = A + B. When SU is high, the difference appears as A = A + B ’.
B Register
The B register is another buffer register. It is used in arithmetic operations. A low LB and
positive clock edge load the word on the W bus into the B register. The two state output of
the B register drives the adder-subtractor, supplying the number to be added or subtracted
from the content of the accumulator.
Output Register
At the end of the computer run, the accumulator contains the answer to the problem being
solved. At this point, we need to transfer the answer to the outside world. This is where the
output register is used.
When EA is high and LO is low, the next positive clock edge loads the accumulator content to
the output register. The output register is often called an output port because the processed
data can leave the computer through this register.
Binary Display
The binary display is a row of eight light emitting diodes (LED’s). Because each LED connects
to one flip-flop of the output port, the binary display shows us the content of the output
port. Therefore, after we transferred an answer from the accumulator to the output port, we
can see the answer in binary form.
Computer is useless until it is programmed. It means loading step by step instructions into
the memory is required to run a computer. To program a computer you must know
instruction sets, the basic operation it can perform. SAP 1 has only 5 instructions. They are:
LDA instruction:
LDA stands for "load the accumulator," A complete LDA instruction includes the hexadecimal
address of the data to be loaded. For example, LDA 8H means “load the accumulator with
the contents of memory location 8H.” Similarly, LDA FH means "load the accumulator with
the contents of memory location FH.
ADD instruction:
ADD 9H means “add the data of memory location 9H with data of accumulator and save the
result in accumulator”.Similarly, the execution of ADD FH adds data at RAM address 15 to
the accumulator and save the answer back in accumulator overwriting the previous value.
SUB instruction:
SUB 9H means “subtract the data of memory location 9H from data of accumulator and save
the result in accumulator.Similarly, the execution of SUB FH subtracts data at RAM address
15 from the accumulator and save the answer back in accumulator overwriting the previous
value.
OUT instruction:
The instruction OUT tells the SAP-1 computer to transfer the accumulator contents to the
output port. After OUT has been executed, you can see the answer to the problem being
solved on LEDs display. OUT is complete by itself; that is, you do not have to include an
address when using OUT because the instruction does not involve data in the memory.
HLT instruction:
HLT stands for halt. This instruction tells the computer to stop processing data so it stops the
clock. HLT marks the end of a program, similar to the way a period marks the end of a
sentence. You must use a HLT instruction at the end of every SAP-1 program; otherwise, you
get computer trash (meaningless answers caused by runaway processing). HLT is complete
by itself; you do not have to include a RAM word when using HLT because this instruction
does not involve the memory.
Example Code:
LDA 8H ; Load 8H memory data to A register
ADD 9H ; Add 9H with the content of Accumulator
ADD AH ; Add AH with the content of Accumulator
SUB BH ; Subtract BH from the content of Accumulator
OUT ; Send the content of accumulator to output register
HLT ; Stop processing
Working of SAP 1:
Everything start from Control Unit, Control Unit turn on Counter which generate address and
move it to bus then CU turn on MAR which fetch address from bus and return data at given
address to the bus, then CU instruct Instruction Register (IR) to collect data from bus, Then IR
move opcode to Control Sequencer (CU) and address bus to Bus. Depended on the opcode
CU performs further action.
For example if instruction is LDA then CU will first resolve the address in bus to data and then
instruct A register to collect it from bus. Then CU will again move to Counter to get address
of another instruction for example of ADD then in this case. Then the instruction will move to
IR and address to bus. According to the opcode CU first resolve address to data by consulting
MAR and then move that data to B register and then move instruct ADD/SUB unit to perform
appropriate work. Depending on the further instruction CU can output A register data to
output LEDs.
Note: Control Sequencer have 12 output to control every element of processor according to
operation code.
SAP-2 Architecture
SAP 2 is the enhanced version of SAP 1 which provides better computing capabilities. The SAP-2
adds a lot of functionality to the SAP-1 hardware. SAP 2 is the next step in the evolution toward
modern computers because it includes jump instructions. These new instructions forced the
computer to repeat or skip part of a program.
B. New Registers
1. MEMORY DATA REGISTER: This register holds the result of a memory access, so we can do other
things with the bus while the memory access happens.
2. B IS NOW CALLED TMP: this makes more sense because it really is an implementation register.
3. B AND C REGISTERS: these can hold operands and can be used for otherinstructions. These
are architectural registers, because they show up in the instructions (as we’ll see)
Bidirectional registers
connect the inputs to the outputs
load and enable never simultaneously active
on load, outputs are 3-state, input is taken from the bus
on enable, inputs are ignored, output goes to the bus
Flags
2 flip flops, sign flag and zero flag
set during arithmetic and logic operations to reflect final accumulator contents
JM jumps only if the sign flag is set (minus result)
JZ jumps only if the zero flag is set (zero result)
JNZ jumps if the zero flag is clear (non-zero result)
Fig: SAP 2
Components of SAP2
1. Input Ports
2. Program Counter (PC)
3. MAR and Memory
4. Memory Data Register MDR
5. Instruction Register (IR)
6. Controller Sequencer
7. Accumulator
8. ALU and Flags
a. Sign Flag
b. Zero Flag
9. TMP, B and C Register
BIT 2ndSem |Microprocessor and Computer Architecture [BIT151] | Unit 1: Page 15
BMC@DC
10. Output Ports
a. Sign Flag
Sign Flag is set when the accumulator contents become
negative during the execution of some instructions.
b. Zero Flag
The Zero flag is set when the accumulator contents are zero.
Problems:
1. What is a microprocessor? What is the difference between microprocessor and a CPU?
2. Differentiate between SAP1 and SAP2.
3. Explain the applications of microprocessor.
4. What is system bus? Explain the types of bus with block diagram.
5. Draw SAP 1 architecture and explain each block in short.
6. Define bit, byte, word and instruction. Differentiate between microprocessor and
microcomputer.
7. Differentiate between microprocessor and microcontroller
8. What are the different types of instructions in SAP1?
9. Explain the registers of SAP2.
10. Draw and explain the SAP2 architecture.
BIT 2ndSem |Microprocessor and Computer Architecture [BIT151] | Unit 1: Page 19
BMC@DC
11. Write a SAP 1 program to perform Addition of two data 06H and 03H and display the result.
Also show the assembly code and machine code in memory as well.
12. Write a program to perform subtraction of 04H from 09H. Display the result. Also show the
assembly code and machine code in memory as well.
13.
- End of Unit 1 -