Module 2 YP
Module 2 YP
Module 2 YP
CONTENTS:
1.1. Introduction
1.2. Microprocessor systems
1.3. Basic elements of control system
1.4. Microcontrollers
1.5. Differences between Microprocessor and microcontroller
Microprocessor architecture terminology- CPU, memory and address, I/O and Peripheral
devices, ALU, Instruction and Program, Assembler, Data Registers, Program Counter, Flags
Fetch cycle, write cycle, state bus interrupts. Intel‟s 8085A Microprocessor Architecture of
Microprocessor
1
1.1 Introduction
Programmable Logic Devices (PLD) are programmable systems and are generally used in
written in its memory, using low level languages of commands. There are following three
1 Microprocessor
It is a digital integrated circuit which carries out necessary digital functions to process the
2 Microcomputer
It uses microprocessor as its central processing unit and contains all functions of a computer.
1. Processor
which processes the information collected from measurement system and takes logical
output devices.
2. Memory
it stores the input data collected from sensors and the programs to process the
written for the processor to perform a task. A group of programs is called software.
3. Input/output devices
these are used to communicate with the outside world/operator.
device called memory, processes the data according to the instructions, and then provides
results as output. In common practice it is also known as CPU (central processing unit). CPU
Intel 4004 was launched in 1971. It was able to process just 4 bits. It started a new era in
electronics engineering. Microprocessor chip was one of the important inventions of the 20th
century.
3
Table 1: the history of micro-processors.
Microprocessor works or operates in binary digits i.e. 0 and 1, bits. These bits are nothing but
electrical voltages in the machine, generally 0 - low voltage level, and 1 - high voltage level.
A group of bits form a „word‟. In general, the word length is about 8 bits. This is called as a
Microprocessor processes the „commands in binary form‟ to accomplish a task. These are
called as „instructions‟. Instructions are generally entered through input devices and can be
Functions of microprocessor:
Various functions of microprocessor are as follows:
a. Microprocessor performs a variety of logical and mathematical operations using its ALU.
b. It controls data flow in a system and hence can transfer data from one location to
on those decisions.
required output based on the predefined value by controlling the parameter responsible for
output.
A control system in which the output is dependent on the input, but input is independent of
output is called open loop control system. E.g.: ON/OFF of an electric lamp, traffic signal
5
A control system in which input is depend on the output. i.e., variation in the output
influences the input by some means of controlling on the input is called a closed loop system.
1. Comparison element.
2. Control unit.
3. Correction unit.
4. Process unit.
5. Feedback unit.
Control unit: Control unit analyses the error signal and decides what action is to be taken.
Correction unit: the modified signal from the control unit will be received by the correction
unit which produces a change in the process to correct or change the controlled condition.
Differences between open loop control system and closed loop control system
Microprocessor based controllers:
Introduction:
Recent development in the large scale integration (LSI), VLSI, SVLSI of semiconductor
devises and the resulting availability of inexpensive microprocessor, memory chips and
analog to digital converters (ADC) have made it possible to use computer as integral part of
control system without much increase in cost. Some of the application areas of
Using data acquisition system (DAS) which converts the analog signals, from various sensors
A keyboard in the system allow the user to enter set point values which are stored in the
memory and the feedback of the current values of the process variable are into the memory,
Relays, solenoids values, DAC and other actuators are used to control the process variables
7
Block diagram of a microprocessor based processor control system of an Automatic
camera:
The range sensor sense the distance of the object to be photographed and this data is input to
microprocessor. The microprocessor in turn sends on output to motor to drive to position the
lens for focusing. The position of the lens is input to microprocessor. Next the light sensor
sends the signal of light intensity on the object to microprocessor. Based on this, signals are
sent to control the duration of time the shutter have to be kept open. All these action and
Once the film has exposed, the information is input to the microprocessor which gives
output for driving the motor for advancing the film to drive and the camera is ready for the
next exposure.
etc., i.e., control action will be executed one after another event. The events to be carried out
Each of these operations involves a number of steps. Soaking involves selection of correct
quantity of detergent and water based on the type and amount of cloth. This requires opening
of the valve to fill the machine drum to required level and closing the valve once the required
level of water has reached and rotating the drum in either direction for a pre-set amount of
This is followed by washing which is a time parameter event. Then the rinsing event which
measures the pH value using a chemical sensor of water in the drum and compares it with
supply of water.
This event continues till the pH value of the water in the cloth and the supply water are
equal. Finally drying operation till the minimum percentage of moisture is retained in the
cloth. All these events were earlier controlled with the help of mechanical system involving a
The amount of detergent, amount of water, pH value is all sensed by the sensor and these
9
Based on the input and the software embedded, the corresponding output of the
IC engine. In the case of four stroke multi cylinder petrol engine, each cylinder has a piston
performing all the four stroke (suction, compression, working or expansion and exhaust
strokes) and the piston rod of each Piston connected to common crankshaft, and their power
The power and speed of an engine are functions of ignition timing and air/fuel mixture.
Hence, by controlling the ignition timing and air/fuel mixture it is possible to control the
speed and power of the engine in modern cars the ignition timing, opening and closing of
valves at appropriate time, quality of air/fuel mixture are controlled by microprocessor with
the help of sensors. For ignition timing the crankshaft drives a distributor which makes
electrical contacts for each spark plug and turns a timing wheel. The timing wheel generates
a microprocessor as its central unit. Based on the input it takes decisions. These decisions are
appliances. They are small in size and can be embedded in an electromechanical system
without taking up much space. Thus we can have a system with its functions completely
designed into a chip. However, microcontrollers have very little user programmable memory.
11
Table 2: Microprocessor and microcontroller comparison
Microprocessor Architecture
The central processing unit (CPU) built on a single chip forms the heart of a computer. The
operations like addition, subtraction, multiplication and division, Logical unit which is
dedicated to take logical decisions like greater than, less than, equal to, not equal to etc.
Memory:
There are two different types of memory segments being used by the CPU. First is the ROM
which stands for Read Only Memory while other is R/W which stands for Read and Write
ROM: From this memory unit, CPU can only read the stored data. No writing operations can
be done in this part of memory. Thus it is used to store the programs that need no alteration or
There are four types of ROM‟s. they are masked ROM, programmable ROM, Erasable
ROM: It is a memory device in which the data is stored permanently. ROM‟s are
programmed with the required contents. No data can then be written into this memory chip in
the computer
13
PROM: Here the ROM can be programmed
EPROM: Here the programmed chip can be altered. The data is erased by shining UV light
EEPROM: It is similar to EPROM; however, the erasing is done the application of high
voltage instead of UV light. Each of the memory locations are identified with the help of a
RAM: As name indicates it is opposite to ROM and used for both reading and writing
operations. In general User‟s program and instruction are stored in this segment of memory
unit.
I/O Devices:
Input Devices: Input devices are used to enter input data to microprocessor from Keyboard or
Output Devices: These devices display the results/conclusions coming out from ALUs either
H, and L, each having capacity to store 8-bit data. They are combined as BC, DE, HL to
perform 16 bit operations. In addition to this Register array, two 16 bit registers viz. stack
register and program counter are provided. As discussed in the earlier lecture, the
the memory address from which the next byte is to be fetched. Stack Pointer points to the
memory location in R/W (Read and/or write) memory. It is also termed as a „stack‟.
Fig 2: Architecture of 8085 microprocessor
Accumulator
The accumulator is 8-bit register (can store 8-bit data). It is a part of arithmetic/logic unit
executed. A program counter is a register in a computer processor that contains the address
(location) of the instruction being executed at the current time. As each instruction gets
fetched, the program counter increases its stored value by 1. ... Within a computer, an
Registers
15
Microprocessors have temporary data holding places called registers. These memory areas
maintain data, such as computer instructions, storage addresses, characters and other data.
Some computer instructions may require the use of certain registers as part of a command.
Each register has a specific function, such as instruction register, program counter,
accumulator and memory address register. For example, a program register holds the address
Assembler
An assembler is a program that converts assembly language into machine code. It takes the
basic commands and operations from assembly code and converts them into binary code that
Assemblers are similar to compilers in that they produce executable code. However,
assemblers are more simplistic since they only convert low-level code (assembly language) to
machine code. Since each assembly language is designed for a specific processor, assembling
a program is performed using a simple one-to-one mapping from assembly code to machine
code. Compilers, on the other hand, must convert generic high-level source code into machine
Flags
ALU of 8085 have five flip flops whose states (set/reset) are determined by the result data of
other registers and accumulator. They are called as Zero, Carry, Sign, Parity and Auxiliary-
Carry flags.
A) Zero Flag (Z): When an arithmetic operation results in zero, the flip-flop called the Zero
B) Carry flag (CY): After an addition of two numbers, if the sum in the accumulator is
larger than eight bits, then the flip-flop uses to indicate a carry called the Carry flag – which
is set to one.
C) S-Sign (S): It is set to 1, if bit D7 of the result = 1; otherwise reset. D7 is the first digit of a
binary number.
A) P-Parity (P): If the result has an even number of 1s, the flag is set to 1; for an odd number
by digit D3 and passed to digit D4, the AC flag is set. Generally, this flag is used internally
Instruction Register/Decoder
Before execution of an instruction, it is sent to the Instruction Register. Instruction register
stores current instruction of any program. Decoder takes the instruction from memory,
Control Generator
In microprocessor, the Control Generator generates a signal that executes the operations in
accordance to the decoded instructions. In fact it creates a signal (information) which have
details about connections between different blocks of the microprocessor so that data reaches
Register Selector
Register selector is basically a logical controller which directs switching between different
registers of microprocessor.
17
General Purpose Registers
Microprocessor has few extra registers which can be used to store additional data during a
program.
Programming in 8085
As mentioned in above section, a simple and very effective substitution to binary codes could
be use of standard English words to complete any task. For example, addition of two numbers
can be represented by ADD. Such codes are referred as mnemonic codes and that language is
8085, are programmed using mnemonics. However, assembly language codes should be
converted into binary one so that microprocessor can identify the instructions given to it. This
C. Operation (Op) Code: It depends on which operation is to be performed. For example, for
D. Operands: Operand is the object on which the required operation is to be done. Generally,
Classification of Instructions:
A) Data Transfer
B) Arithmetic
C) Logical
D) Program Control
Data Transfer
1. Load: It reads content from specified memory location and copies it to specified register
location in CPU.
Arithmetic:
Add: It adds contents of a specified memory location to the data in some register. B
Compare: It tells whether contents of a register are greater than, less than or same as content
Logical:
AND: Instruction carries out Logical AND operation with the contents of specified memory
location and data in some register. Numbers are ANDed bit by bit.
OR: Instruction carries out Logical OR operation with the contents of specified memory
location and data in some register. Numbers are ORed bit by bit.
Logical Shift: Logical shift instruction involves moving a pattern of bits in the register one
Program Control:
Jump: This instruction changes the sequence in which program steps are carried out.
Normally program counter causes the program to be carried out sequentially in strict
numerical sequence. However, JUMP causes program counter to some other specified
Branch: This is a conditional instruction which might „branch‟ if „zero‟ results or „branch‟ if
„plus‟ results of an operation. Branch also followed if right conditions occur in the decision
making process.
Fetch cycle
it is called Fetch -decode-execute cycle or sometime it‟s called fetch cycle. In Fetch
cycle, CPU fetch some data or instruction from main memory then store it into its internal
19
QUESTION BANK:
1. List out any four differences between Microcontroller and Microprocessor. (Dec
2018/Jan 2019), (June /July 2018), (Dec 2014/Jan 2015), (Dec 2013/Jan 2014).
2. Discuss the Basic Elements of Microprocessor based control system. (Dec 2018/Jan
2019), (Dec 2017 /Jan 2018)
3. What is a Register? Sketch and explain Program Counter. (Dec 2018/Jan 2019)
4. Explain with the block diagram of a Microcontroller. (Dec 2018/Jan 2019), (June
/July 2016), (Dec 2013/Jan 2014)
5. Explain in detail with the block diagram the architecture of intel 8085 A
microprocessor (June /July 2018), (June /July 2015), (Dec 2014/Jan 2015), (Dec
2013/Jan 2014)