2nd CHAPTER Mechatronics
2nd CHAPTER Mechatronics
By
V. THULASIKANTH
Assistant Professor
Mechanical Engineering Department
DEVELOPMENT OF MICROPROCESSORS
Earlier we came through implementation of combinational and sequential logic operations
by interconnecting ICs containing gates and flip-flops.
This is considered a hardware solution because it consists of a selection of specific ICs,
which when hardwired on a circuit board, carry out predefined functions.
To make a change in functionality, the hardware circuitry must be modified and may
require a redesign. This is a satisfactory approach for simple design tasks.
However, in many mechatronic systems, the control tasks may involve complex
relationships among many inputs and outputs, making a strictly hardware solution
impractical.
A more satisfactory approach in complex digital design involves the use of a
microprocessor-based system to implement a software solution.
Software is a procedural program consisting of a set of instructions to execute logic and
arithmetic functions and to access input signals and control output signals.
An advantage of a software solution is that, without making changes in hardware, the
program can be easily modified to alter a mechatronic systems functionality.
3
Intel 8085
WHAT IS MICROPROCESSOR?
A microprocessor is a single, very-large-scale-integration (VLSI) chip that
contains many digital circuits that perform arithmetic, logic, communication, and
control functions.
When a microprocessor is packaged on a printed circuit board with other
components, such as interface and memory chips, the resulting assembly is
referred to as a microcomputer or single-board computer.
In 1971 Intel Corporation introduce 4004, a 4-bit microprocessor and its basic
circuit contains 2300 transistors.
The Intel 8085 ("eighty-eighty-five") is an 8-bit microprocessor introduced by
Intel in 1977.
5" in the model number came from the fact that the 8085 requires only a +5-Volt
(V) power supply.
The Intel 8085 required at least an external ROM and RAM and an 8 bit address
latch (both latches combined in the Intel 8755 2Kx8 EPROM / 2x8 I/O, Intel 8155
256-byte RAM and 22 I/O and 14 bit programmable Timer/Counter)
At a first sight, the microprocessors are specified by: Number of bits it can
handle for data processing and speed of operation.
Higher the bits microprocessor can handle for data processing more faster.
The speed of the operation is estimated from the clock frequency of the
microprocessor.
APPLICATIONS OF MICROPROCESSOR
Actuator control system: Speed, velocity and acceleration control of electric
motor, fluid power actuators.
Control system for home appliances: Microwave oven, washing machine,
refrigerator, heating system, air conditioner, etc
6
Intel
Motorola
Toshiba
Fairchild
7
Phillips
Cyrix
National Semiconductor
Zilog
Texas Instruments
WORKING OF MICROPROCESSOR
The microprocessor, also called the central processing unit (CPU) or
microprocessor unit (MPU), is where the primary computation and system
control operations occur.
It consists of semiconductor memories like EPROM, RAM, input/output device
an interfacing devices.
The arithmetic logic unit (ALU) within the CPU executes mathematical functions
on data structured as binary words.
8
10
word is an ordered set of bits, usually 8, 16, 32, or 64 bits long. The
Buses: The buses are group of lines that carries data, address or control
signals. With the help of buses, the devices communicate with one another.
Data lines are used to communicate words to and from data registers in the various
system components such as memory, CPU, and input/output (I/O) peripherals.
Address lines are used to select devices on the bus or specific data locations within
memory.
Control lines transmit read and write signals, the system clock signal, and other
11control signals such as system interrupts, which are described in subsequent
sections.
A key to a CPUs operation is the storage and retrieval of data from a memory
device. Different types of memory include read-only memory (ROM),
randomaccess memory (RAM), and erasable-programmable ROM (EPROM).
ROM is used for permanent storage of data that the CPU can read, but the CPU
cannot write data to ROM.
ROM does not require a power supply to retain its data and therefore is called
nonvolatile memory.
Data stored in an EPROM can be erased with ultraviolet light applied through a
transparent quartz window on top of the EPROM IC. Then new data can be
12
stored on the EPROM
14
8085 Microprocessor
It is a 8 bit microprocessor.
It has 16-bit address bus and hence can address up to 216 = 65536 bytes (64KB)
memory locations through A0-A15 .
The first 8 lines of address bus and 8 lines of data bus are multiplexed AD0 AD7
Data bus is a group of 8 lines D0 D7 .
It supports external interrupt request.
A 16 bit program counter (PC)
A 16 bit stack pointer (SP)
Six 8-bit general purpose register arranged in pairs: BC, DE, HL.
It requires a signal +5V power supply and operates at 3.2 MHZ single phase
clock.
It is enclosed with 40 pins DIP (Dual in line package).
15
16
Accumulator
The accumulator is an 8-bit register (can store 8 bit data) that 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
17Register A.
Flags
ALU of 8085 have five flip flops whose states (set/reset) are determined by the
result data of various other registers and accumulator. They are called as Zero,
Carry, Sign, Parity and auxiliary carry.
Instruction Register/Decoder
Before execution of instruction, it is sent to Instruction Register. Instruction
register stores current instruction of any program. Decoder takes the instruction
from memory, decodes it and then passes it to next stage.
18
1. Address Bus.
2. Data Bus.
3. Control and Status
Signals.
4. Power supply and
frequency.
5. Externally Initiated
Signals.
6. Serial I/O ports.
19
unidirectional.
The other 8 address bits are multiplexed (time shared)
with the 8 data bits.
So, the bits AD0 AD7 are bi-directional and serve as
A0 A7 and D0 D7 at the same time.
During the execution of the instruction, these lines
carry the address bits during the early part, then
during the late parts of the execution, they carry the
8 data bits.
In order to separate the address from the data, we can
use a latch to save the value before the function of the
bits changes.
group.
X0 and X1 are the inputs from the crystal or clock
generating circuit.
The frequency is internally divided by 2.
So, to run the microprocessor at 3 MHz, a clock
running at 6 MHz should be connected to the X0
and X1 pins.
CLK (OUT): An output clock pin to drive the clock of the
RESET signal
Following are the two kind of RESET signals:
RESET IN: an active low input signal, Program Counter (PC)
25
Interrupt signals
An interrupt is a hardware-initiated subroutine CALL.
26
As the heartbeat is required for the survival of the human being, the
CLK is required for the proper operation of different sections of the
microprocessors.
All actions in the microprocessor is controlled by either leading or
trailing edge of the clock.
The execution of instruction always requires read and writes
operations to transfer data to or from the P and memory or I/O
devices.
Each read/ write operation constitutes one machine cycle (MC1)
27
Each machine cycle consists of many clock periods/ cycles, called Tstates.
The heartbeat of the microprocessor is the clock period.
Each and every operation inside the microprocessor is under the
control of the clock cycle.
The clock signal determines the time taken by the microprocessor to
execute any instruction.
The clock cycle shown in Fig. has two edges (leading and trailing or
lagging).
State is defined as the time interval between 2-trailing or leading
edges of the clock.
Machine cycle is the time required to transfer data to or from memory
or I/O devices.
28
29
PROCESSOR CYCLE
The function of the microprocessor is divided into fetch and
execute cycle of any instruction of a program.
In the normal process of operation, the microprocessor fetches
(receives or reads) and executes one instruction at a time in the
sequence until it executes the halt (HLT) instruction.
Thus, an instruction cycle is defined as the time required to fetch
and execute an instruction.
For executing any program, basically 2-steps are followed
sequentially with the help of clocks, (1) Fetch and (2) Execute.
The time taken by the P in performing the fetch and execute
operations are called fetch and execute cycle.
30
31
32
SENSOR
Analog
ADC Digital
Digital
DAC
Analog
ACTUATOR
33
Analog Signals
Analog signals directly measurable quantities in terms of some other
quantity
Examples:
Thermometer mercury height rises as temperature rises
Car Speedometer Needle moves farther right as you accelerate
Stereo Volume increases as you turn the knob.
Digital Signals
Digital Signals have only two states. For digital computers, we refer to
binary states, 0 and 1. 1 can be on, 0 can be off.
Examples:
Light switch can be either on or off
Door to a room is either open or closed
35
ADC0809
National Semiconductor
37
4.39
Step 1: Quantizing
Output
States
Example:
You have 0-10V
0
signals. Separate them 1
into a set of discrete
2
states with 1.25V
increments. (How did 3
we get 1.25V? See
4
next slide)
Discrete Voltage
Ranges (V)
0.00-1.25
1.25-2.50
2.50-3.75
3.75-5.00
5.00-6.25
6.25-7.50
7.50-8.75
8.75-10.0
Quantizing
The number of possible states that the
converter can output is:
N=2n
where n is the number of bits in the AD converter
Example: For a 3 bit A/D converter, N=23=8.
Analog quantization size:
Q=(Vmax-Vmin)/N = (10V 0V)/8 = 1.25V
Encoding
Output
States
000
001
010
011
100
101
110
111
Resolution
47
Staircase ramp
Successive approximation
Dual slope
Voltage to frequency
Parallel (or flash)
D/A Converter
DACs are electronic circuits that convert digital, (usually binary) signals
(for example, 1000100) to analog electrical quantities (usually voltage)
directly related to the digitally encoded input number.
Register
Analog Voltage
Output
48
Voltage
Switch
Resistive
Summing
Network
Amplifier
50