0% found this document useful (0 votes)
13 views

mechatronics unit II by ffMGVii.pptxfinal - Copy

Uploaded by

manju
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

mechatronics unit II by ffMGVii.pptxfinal - Copy

Uploaded by

manju
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 48

MECHATRONICS

Module-II

Microprocessor &Microcontrollers

By

Maruthi G Venkat BE, M.Tech


Assistant Professor
Mechanical Engineering Department
STJIT Ranebennur
1
Micro()processor ?
It is an electronic device;

Which has many memory locations known as registers, to hold information.

Can understand a fixed set of basic commands and performs operations as


instructed by (ALU)

Can generate signals to control external devices (control unit).

Maruthi G Venkat, Assistant 2


professor, STJIT Ranebennur.
The p chip has several pins, over which p sends or receives information.

These connections between the pins is termed as lines.

p has several lines like;

a. Address lines known as address bus.


b. Data lines commonly known as data bus.
c. Control lines to control I/P and O/P devices.
d. Finally other control signals for controlling off chip memory.

Maruthi G Venkat, Assistant 3


professor, STJIT Ranebennur.
Maruthi G Venkat, Assistant 4
professor, STJIT Ranebennur.
Microprocessor Systems
Microprocessor systems have three parts

Central processing unit (CPU) : It is used to recognize and carryout instructions.


This is the part which uses the microprocessor.

Input and output interfaces to handle communications between the computer and
outside world the term port is used for the interface.

Memory to hold the program instructions and data.

Maruthi G Venkat, Assistant 5


professor, STJIT Ranebennur.
Basic elements of control system
It is observed that Microprocessor based automation and control solution to
mechanical systems require five primary components. They are

•Transducer (or) sensor


•Actuators (S)
•The processing element
•Interfacing and signal conditioning circuits
•The memory.

Maruthi G Venkat, Assistant 6


professor, STJIT Ranebennur.
•Transducer (or) Sensor senses the signal and actuator activates once it is
commanded to do so.

•For relatively larger control applications more than a hundred and comparatively
less number of actuators used and this again depends on control at hand.

•Analog to digital converters, Digital to analog converters, isolators, amplifiers etc


are known as signal conditioning circuits.

•Interfaces includes electrical and mechanical components along with electronic


circuits. Where as signal conditioning circuits refer to only electronic circuits.

Maruthi G Venkat, Assistant 7


professor, STJIT Ranebennur.
Microcontrollers
•The Microcontroller is an integration of a microprocessor with memory and
input/output interfaces and other peripherals such as timers on single chip.

•A microcontroller is a compact integrated circuit designed to govern a specific


operation in an embedded system. A typical microcontroller includes a processor,
memory and input/output (I/O) peripherals on a single chip.

Maruthi G Venkat, Assistant 8


professor, STJIT Ranebennur.
Microcontroller

Maruthi G Venkat, Assistant 9


professor, STJIT Ranebennur.
•Sometimes referred to as an embedded controller or microcontroller unit
(MCU), microcontrollers are found in vehicles, robots, office machines,
medical devices, mobile radio transceivers, vending machines and home
appliances, among other devices.

•They are essentially simple miniature personal computers (PCs) designed


to control small features of a larger component, without a complex front-
end operating system (OS).

Maruthi G Venkat, Assistant 10


professor, STJIT Ranebennur.
•A microcontroller is embedded inside of a system to control a singular
function in a device. It does this by interpreting data it receives from its
I/O peripherals using its central processor.
•The temporary information that the microcontroller receives is stored in
its data memory, where the processor accesses it and uses instructions
stored in its program memory to decipher and apply the incoming data.
•It then uses its I/O peripherals to communicate and enact the appropriate
action.

Maruthi G Venkat, Assistant 11


professor, STJIT Ranebennur.
Microcontrollers are used in a wide array of systems and devices. Devices often
utilize multiple microcontrollers that work together within the device to handle their
respective tasks.
For example : a car might have many microcontrollers that control various
individual systems within, such as the anti-lock braking system, traction control, fuel
injection or suspension control. All the microcontrollers communicate with each
other to inform the correct actions. Some might communicate with a more complex
central computer within the car, and others might only communicate with other
microcontrollers. They send and receive data using their I/O peripherals and process
that data to perform their designated tasks.
Maruthi G Venkat, Assistant 12
professor, STJIT Ranebennur.
Maruthi G Venkat, Assistant 13
professor, STJIT Ranebennur.
Maruthi G Venkat, Assistant 14
professor, STJIT Ranebennur.
Microcontroller Microprocessor
1. Microcontroller is a heart of the 1. The microprocessor is the heart of
embedded system computer system.
2. Microcontroller has an external 2. It is just a processor, memory and I/O
processor along with internal memory components have to be constructed
and input and output components. externally.
3. Since memory, I/O are present 3. Since memory, I/O has to be
internally the circuit is small. connected externally
4. The cost of the entire system is low 4. The Cost of the entire system
increases
5. The microcontroller has a number of 5. Microprocessor has less number of
registers, hence the programs are easier registers, hence more operations are
to write memory based
6. Used mainly in the washing machine, 6. Mainly used in personal computers
MP3 players

Maruthi G Venkat, Assistant 15


professor, STJIT Ranebennur.
Microprocessor Architecture
•It has already been pointed out that the microprocessor describes itself as a central
processing unit for the control solution.
•It has also be indicated that the microprocessor has doe common and optimal internal in
structure (Basic building blocks in order to the automation and control need.
•The interconnection of internal infra structure of the micro processor is universally
known as microprocessor infra structure.
•In order to understand how the microprocessor works you must study the architecture.

Maruthi G Venkat, Assistant 16


professor, STJIT Ranebennur.
Microprocessor terminologies
 CPU
• It is the abbreviation of central processing unit. The microprocessor itself is called as
CPU. Some microprocessor and micro controller contain more than one CPU in
order to achieve faster instruction processing.

Maruthi G Venkat, Assistant 17


professor, STJIT Ranebennur.
MEMORY AND ADDRESS
A memory is a physical device where program, data etc are stored. A memory
device contains many memory location is defined in terms of an address, which is
a unique number a particular microprocessor based control application.
The following figure illustrates a memory device whose address space is 0000 to
03FF. The length of the address space of this memory device (or) chip is 1K bytes
ie, 1024 bytes.

Maruthi G Venkat, Assistant 18


professor, STJIT Ranebennur.
MEMORY AND ADDRESS

Maruthi G Venkat, Assistant 19


professor, STJIT Ranebennur.
•Microprocessor can store and retrieve data in and from the memory
respectively. When the processor needs data from a specific location, it sends
the address to the memory over the address path.
•The decoder circuit within the memory device decodes the address (which
has been sent by other devices) in order to select a specific location.
•The data is read and sent back to the microprocessor. A memory chip must
have a data path and a address path. Data path is bidirectional and address path
is unidirectional.

Maruthi G Venkat, Assistant 20


professor, STJIT Ranebennur.
• Vcc is the DC supply signal usually 5 volts and VGG is ground terminal. RD is input
signal is essential if the content of the specific location is needed to read.

• RD goes high for data read operations.WR in similar context goes high for data write
operations. CE (enable) signal has to be given for a chip solutions. The memory chip must
be selected if read (or) write operations are to be carried out.

• Memory space is the range of memory locations that a microprocessor can address. The
number of address lines determines the memory space. Microprocessor with 16 bit and 24
bit address lines have 216 = 64K and 224= 16M of memory space respectively.
Maruthi G Venkat, Assistant 21
professor, STJIT Ranebennur.
INPUT AND PERIPHERAL DEVICES
• I/O stands for input and output. I/O and peripheral devices are sensors, actuators,
switches, A/D converters, D/A converter PWM (pulse width modulators), ports,

Transceivers, memory controllers, Timers, counters etc.

ALU (Arithmetic and Logic unit)


It has mainly two parts
•Asthmatic unit which is responsible for mathematical operations like Addition,
Subtraction, Multiplication and Division.
•Logic unit which is dedicated to take logical decisions like greater than, less than, equal
to, not equal to etc (basically AND/NOT operation)
Maruthi G Venkat, Assistant 22
professor, STJIT Ranebennur.
INSTRUCTION AND PROGRAM
• A program is a logical sequence of instructions that directs the microprocessor to
perform a desired task. Programs are developed using instructions.
•A microprocessor has a fixed set of instructions compatible to its internal hardware
architecture depending upon the control functionality and application requirements, a
program is developed selecting appropriate instructions from the set is provided.
•Once the program is developed it is supposed to be stored in the memory sequentially.
•The microprocessor fetches one instruction at a time and executes it and does according
to the instruction.

Maruthi G Venkat, Assistant 23


professor, STJIT Ranebennur.
ASSEMBLER
• In many situation the programmer enters the program into the memory of a
microprocessor based system in assembly language.
•Since the microprocessor understands machine language the assembly language has to
be converted to machine language through a language converter the language converter
is known as assembler.
•An assembler may be realized with hardware (or) software sometimes the conversion is
achieved instruction wise ie, the conversion is carried out one instruction after the other
or program wise the entire program (assembler language) is converted to machine
language in one go. The instruction wise conversion is specified as interpreter another
name of assembler. Maruthi G Venkat, Assistant 24
professor, STJIT Ranebennur.
 Data
• Data refers to DNS (Digital number System). A bit is the smallest unit of data. At the
micro-level, data and instruction are represented using bits.
•Data usually refers to value, where as instructions are coded form of functions using
which the microprocessor executes.
•Instructions are operation codes (or) OPCODES. The instructions are unique to the
microprocessor architecture therefore microprocessor can distinguish between ordinary
data and the unique instructions.
•Although data and instructions are just combination of bits, the same is difficult for us
to distinguish the microcontroller relies soley on the order in which data and instructions
enter into it. As a thumb rule, the first program byte entering into the microprocessor is
Maruthi G Venkat, Assistant 25
always instruction. professor, STJIT Ranebennur.
Registers

• I think you already know that data flows in and out of the CPU. The data may come
from the A/D converter (which may been obtained from the transducer (or) sensor) (or)
from some other locations within the microprocessor based systems. This is called data
transaction.
•The CPU requires some temporary storage cells so that intermediate data can be stored
temporarily either for data transactions (or) for later use, The temporary storage cells are
called temporary registers.

Maruthi G Venkat, Assistant 26


professor, STJIT Ranebennur.
Registers

Maruthi G Venkat, Assistant 27


professor, STJIT Ranebennur.
• As figure shown above describes the some of the temporary registers within the
microprocessor. The registers are 8-bit, 16-bit (or) more.
•While internal circuit design of all the registers within the microprocessor remains
same. Several registers have been built into it adhering different names. In fact the
nomenclature of registers is based on the type of the data they store.
•Some of the name of the important registers are Data Registers(DR), Instructional
Registers (IR), I/O ports, Accumulators(ACC), Program Counter(PC), Memory Address
Registers(MAR), and Flags.

Maruthi G Venkat, Assistant 28


professor, STJIT Ranebennur.
• Data Registers
It is a special register which holds data when they are fetched from the memory (or)
input device. As you know data and instructions are said to be different. Data fro the
outside world comes to the input buffer then it is transferred to the data registers.
• Instruction Registers
This is the register (or) group of registers and only accommodates instruction. The user
written program (OPCODE) flows from the memory into the microprocessor in
sequence. After being fetched from the memory the OPCODE is placed in the instruction
register.

Maruthi G Venkat, Assistant 29


professor, STJIT Ranebennur.
Program Counter :

•Program Counter, called PC, is a register that holds the next address of the instruction. At the
end of the execution of the current instruction, the content one of the PC (the next address) is
transferred to the memory and decoded ln order to get the next item of the executable code.
The next item could be a data or an instruction.

•PC is the main functional unit of microprocessor. If the entire program (executable code) is 16
bytes long and is stored in a location starting from 2000H to 200F, then the PC starts
addressing 2000H to 200F sequentially in order make it possible to fetch program bytes from
these locations one-by-one The address of the next location of the memory location is being
addressed at the end of the current cycle.

• Currently the microprocessor has just completed the execution of the program byte located at
200B, while the PC at this instant holds the address of the next location, which is 200C via the
on buffer.
Maruthi G Venkat, Assistant 30
professor, STJIT Ranebennur.
Program Counter

Maruthi G Venkat, Assistant 31


professor, STJIT Ranebennur.
FLAGS:

•The flag register in the microprocessor is a special purpose register in which the individual bit values
represents the standing of a result byte. The flag bits are automatically modified in accordance with the
result and the type of operation performed.

•The result byte could be a positive or negative number (after mathematical operation is over), and a
dedicated flag bit implies this piece of information, i.e. whether the result is positive or negative.

•In another situation , the result byte could be indicates this information i.e. whether the result is zero.
The microprocessor tests the result of the operation, and the test result is thus stored in the flag register.

•The flag bits in many situations are more important than result itself. The programmer, when
necessary, uses the tested and recorded flag bits.

• Following flag bits are common within the design and construction of most of the microprocessor and
micro controllers.
Maruthi G Venkat, Assistant 32
professor, STJIT Ranebennur.
Fetch Cycle
•The microprocessor fetches the OPCODE or data from the memory or input devices as follows. The
content o1 the PC, the address is placed in the MAR.

• The content of the MAR is then transferred to the decoder, which is interfaced or in built with the
memory device . The decoder decodes the address, and selects the appropriate location according to the
address supplied to it.

•The content of the specified address is read and transferred into the microprocessor.
If the item read is an OPCODE, then it is placed in the Instruction Register, and if the item read is data,
then it is placed in the Data Register. This is a fetch cycle or memory read cycle.

Maruthi G Venkat, Assistant 33


professor, STJIT Ranebennur.
Fetch Cycle

In particular, following events are Carried out within a fetch cycle:

• Send address through address bus.


• Decode the address.
• Read the content of the specified location.
• Transfer the content of the specified location in the memory to the microprocessor.

Maruthi G Venkat, Assistant 34


professor, STJIT Ranebennur.
Writes Cycle
•Writes cycle is one that interprets writing operation. Microprocessor can send data to a
specific location of the memory or to an output device.

•During writing operation, the microprocessor transfers the content of the PC to the
memory decoder through the MAR. Microprocessor uses WR (Write) signal for writing into
the memory.

Maruthi G Venkat, Assistant 35


professor, STJIT Ranebennur.
STATE
The microprocessor processes data at a rate, which is determined by the clock signal (crystal
output) it has been interfaced with. The time required to complete a read (fetch) and write
cycle is measured in terms of state. The state is related to the clock frequency of the
microprocessor.
Some microprocessors operate at higher clock frequency and some at lower clock frequency.
Usually it is operated with a frequency, which is half of the crystal frequency, f OSC as shown
in the Fig. 8

Maruthi G Venkat, Assistant 36


professor, STJIT Ranebennur.
BUS

OPCODE, operands and address bytes are transferred through bus. A bus is a transmitting media
consisting of group of lines. The number of lines are usually 8, 16, 32, etc. They connect each
and every unit within the microprocessor. Some buses are bi-directional and some are
Unidirectional meaning the bi-directional buses transfers data in both directions,
where as unidirectional buses carries data in only one direction. Buses, which carry address
and data are called Address bus and data -bus, respectively. They may be external or internal.
Some buses are used in multiplexed mode. For example, in one occasion they are used as address
bus, and in another occasion they are used as data bus. Time Division Multiplexing (TDM) is
used with regard to multiplexed mode operation.

Maruthi G Venkat, Assistant 37


professor, STJIT Ranebennur.
Maruthi G Venkat, Assistant 38
professor, STJIT Ranebennur.
Interrupts
In a typical microprocessor-based control implementation usually the external input devices such as
sensors, A/D converters, Input ports, Programmable Interrupt Controller (PIC), Direct Memory
Access Controller (DMAC), etc. are interfaced with the microprocessor through some special lines
called interrupt lines or interrupt pins, and these lines are input lines . Generally, the data
transaction from the external devices into the microprocessor is not implicit for which a request and
acknowledgement type signal is needed. The external device sends an interrupt signal to
microprocessor when it wants to establish a dynamic link for data transaction. For example, when an
A/D digital converter completes its conversion process, (i.e. analog signal to its digital equivalent),
it can request the microprocessor in terms of interrupting it to accept the digital data for use. A/D
converter interrupts the microprocessor informing that it is ready to transfer the digital data. The
microprocessor then sends an interrupt acknowledgement signal to the A/D converter.
Maruthi G Venkat, Assistant 39
professor, STJIT Ranebennur.
Then only transaction takes place. This is a typical example. In order to handle several devices, more
numbers interrupts lines are required. A microprocessor must have adequate number of interrupts
lines in order to deal with acceptable number of devices. When the number of interruptible devices
are more than the number of interrupt lines a microprocessor has, the situation could be solved
through technique which is called as vectored interrupts. Vectored interrupts is a nested scheme, and
polling methods are employed for device identification. Polling is a technique to identify a device
among many that has interrupted. Polling can be implemented through hardware, software or
combination of both.

Maruthi G Venkat, Assistant 40


professor, STJIT Ranebennur.
Maruthi G Venkat, Assistant 41
professor, STJIT Ranebennur.
Internal Architecture of 8085 Microprocessor
A. Register Array
•8085 Microprocessor consists of six registers, one accumulator and a flag register. The typical
architecture is shown in figure 6. There are six general-purpose registers B, C, D, E, 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
‘program counter’ is employed to sequence the execution of instructions. It always points to 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’.

Maruthi G Venkat, Assistant 42


professor, STJIT Ranebennur.
Architecture of 8085 microprocessor
Maruthi G Venkat, Assistant 43
professor, STJIT Ranebennur.
B. Accumulator

The accumulator is 8-bit register (can store 8 bit data). It is a part of arithmetic/logic unit (ALU). In general,
after performing logical or arithmetical operations, result is stored in accumulator. Accumulator is also
identified as Register A.

Maruthi G Venkat, Assistant 44


professor, STJIT Ranebennur.
C. 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 flag - which is set to one.
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.

Maruthi G Venkat, Assistant 45


professor, STJIT Ranebennur.
A P-Parity (P): If the result has an even number of 1s, the flag is set to 1; for an odd
number of 1s the flag is reset.

B AC-Auxiliary Carry (AC): In an arithmetic operation, when a carry is generated


by digit D3 and passed to digit D4, the AC flag is set. Generally this flag is used
internally for Binary Coded Decimals (BCD).

Figure 3.2.2 shows a 8-bit flag register, adjacent to the accumulator. It is not used as a
register. Out of eight bit-positions, five positions are used to store the outputs of five
flip-flops.
These flags play an important role in decision-making process of the
microprocessor.

Maruthi G Venkat, Assistant 46


professor, STJIT Ranebennur.
E. 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, decodes it and then passes it to the
next stage.

F. Memory Address Register


Memory Address Register (MAR) holds the address of next instruction to be executed.

G. 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 to the respective place.

Maruthi G Venkat, Assistant 47


professor, STJIT Ranebennur.
H. Register Selector
Register selector is basically a logical controller which directs switching between different registers of
microprocessor.

General Purpose Registers


Microprocessor has few extra registers which can be used to store additional data during a program.

Maruthi G Venkat, Assistant 48


professor, STJIT Ranebennur.

You might also like