Chapter 7
Chapter 7
Chapter 7
CHAPTER - 7
2
In Binary, there are only 0’s and 1’s
000 = 0
• Voltages are used to represent logic values:
001 = 1 • A voltage present (called Vcc )= 1
Binary to Decimal
3
• Basic Digital logic is based on 3 primary
functions (the basic gates):
– AND
– OR
– NOT
4
• The AND function:
– If all the inputs are high, the output is high
– If any input is low, the output is low
• “If this input AND this input are high, the
output is high”
5
Inputs Output
6
0
Inputs 0 Output
0
7
0
Inputs 0 Output
1
8
Inputs
1 Output
1 1
9
• To help understand the function of a digital device, a Truth Table is
used. The Truth Table tabulates the relationship between the
inputs and the output of a logic gate
Inputs Output
0 0 0
Every possible
0 1 0
input combination 1 0 0
1 1 1
AND Function
10
• It is possible to have AND gates with more
than 2 inputs. The same logic rules apply –
“if any input…”
A
B A+B+C ABC
C C
B
A A
B A+B+C ABC
B
C
C
11
• The OR function:
– if any input is high, the output is high
– if all inputs are low, the output is low
• “If this input OR this input is high, the output is
high”
12
Inputs Output
13
0
Inputs 0 Output
0
14
0
Inputs 1 Output
1
15
1
Inputs 1 Output
1
16
• Truth Table
Inputs Output
0 0 0
0 1 1
1 0 1
1 1 1
OR Function
17
• The NOT function:
– If any input is high, the output is low
– If any input is low, the output is high
18
Input Output
19
Input 0 1
Output
20
Input 1 0
Output
21
• Truth Table
Input Output
0 1
1 0
NOT Function
22
• A circuit that utilizes more that 1 basic logic
function is called Combinational Logic.
23
• The NAND gate is the combination of an NOT
gate with an AND gate.
24
• The NOR gate is the combination of the NOT
gate with the OR gate.
OR NOT NOR
25
Complete the Truth Table for the NAND and NOR Gates?
NAND NOR
Input Output Input Output
0 0 1 0 0 1
0 1 1 0 1 0
1 0 1 1 0 0
1 1 0 1 1 0
Hint: Think of the AND and OR truth tables. The outputs for the NAND and NOR are inverted.
26
The XOR gate
• The EXCLUSIVE-OR gate can be considered to be an OR gate with a NOT gate
applied to one of the inputs to invert it before the inputs reach the OR gate.
• Alternatively it can be considered as an AND gate with a NOT gate applied to one
of the inputs to invert it before the inputs reach the AND gate
Symbol A
A Q
B
Q
B NOT
Truth table
Boolean equation Inputs Output
A B Q
0 0 0
0 1 1
1 0 1
1 1 0
• Digital Electronics devices are usually in a chip
format.
• The chip is identified with a part number or a
model number.
• A standard series starts with numbers 74, 4, or
14.
– 7404 is an inverter
– 7408 is an AND
– 7432 is an OR
– 4011B is a NAND
28
• Basic logic chips often come
Pin 14 Pin 8
in 14-pin packages.
• Package sizes and styles
vary.
• Pin 1 is indicated with a dot
or half-circle
• Numbers are read counter-
clockwise from pin 1 (viewed
from the top)
Pin 1 Pin 7
29
• Chips require a voltage to
Pin 14 Pin 8
function
Pin 1 Pin 7
30
Voltage
Ground
Vcc IN
OUT
Vcc Probe
33
Boolean algebra
• Defines the rules for expressing and binar log
statements.The
simplifing basic Boolean laws and identities y ic
follows laws
Fundamental
OR AND NOT
Comutative laws
Associative laws
Distributive laws
De Morgan’s laws
• Useful in rearranging or simplifying longer
boolean expressions or converting between AND and OR
gate:
Operating state 1
Operating state 2
Operating state 3
Step 2: write quasi-logic
statements
• We further translate the word
statements into logic like
statements.The quasi-logic statements for the security system
are:
Activate the alarm (Y=1) if A is high and the code
CD is 01 or
activate the alarm if Aor B is high and the code is 10.
• Note the italicized quasi-Boolean operators, which should aid
in writing the Boolean expression.
Step 3&4: Write the Boolean expression & simplify
• To create a product of 1 for the active control code 10, we need to
form the expresssion . Based on this, the complete Boolean
expression for the security system is
A
Y
D
Step 6: Draw the circuit
• Case 2: UsindigaAND
gram& NOT
gates
A B C D
A.D
Y
~END
~
8.BASICS OF MICROPROCESSORS
INTRODUCTION
For a simple control problem it is possible to solve it by
a
n electronic control system involving combinational
and sequential logic integrated circuits.
Eg:sequencing of red, yellow, green lights at a traffic crossing
:Simple security protection system for a house
However with a more complex situation there might be
many more variables to control in a more complex sequence.
A more satisfactory approach in complex digital design
involves the use of a microprocessor-based system to
implement a software solution.
Software is aprocedural program consisting of a set of
instructions to execute logic and aritmetic functions and
to access input signals and to control output signals.
An advantage of a software solution is that, with out
making changes in hardware ,the program can be easily
modified to alter the mechatronic system functionality.
MICROPROCESSOR AND MICROCOMPUTER
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 aprinted
circuit board with other components, such as interface
and memory chips, the resulting assembly is reffered
to as a microcomputer or single-board computer.
Microcomputer has three sections
CPU:- to carry out programs instructions
Input & Output interfaces:-to
handle communication between the computer
and the outside world.
Memory:- to hold program instructions and data.
BUSES
Digital signals move from one section to another along pathes
called buses.
A bus in a physical sence, is just a number of conductors
along which electrical signals can be carried.It might be tracks on a
printed circuit board or wires in a ribbon cable.
Data bus:- Used to transport data from/to the CPU and the
memory or the input/output devices. Data length could be 4, 8, 16,
32, or 64 bit.
Adress bus:- carries signal which indicates where data is to b e
found. Each memory location has an address that must be
specified before the contents of that location can be
accessed.
Control bus:- Used to synchronize the operation of the different
elements.It transmits read and write signals, system clock signals,
and other control signals.
Address bus
Data bus
Control bus Memory CPU Input/Output
CENTRAL PROCESSING UNIT- CPU
Processes the data by executing a program stored
in the memory.
Consists of:
Arithmetic and Logic Unit (ALU):- performs the
data manipulations or executes mathematical
functions on data structured as binary words.
Registers:-are memory locations with in the
microprocessor and used to store information
involved in program execution.
Control unit:- determines the timing and
sequence of operations. Responsible for the control
of address, data and control buses.
All actions within µP synchronized to the CPU via a
clock signal
Registe
1. r
Accumulator register:- temporary holding register for data
to be operated on by ALU and after operation holds the
results.
2. Status register/flag register:- carries information
concerning the results of the latest process carried out
in ALU.
3. Program counter register:- it allows the CPU to keep track
of its position in the program.
4. Memory address register:- contains the address of data.
5. Instruction register :- stores instructions.
6. General purpose register:- temporary storage of
data or addresses, involved in the transfer
between registers.
7. Stack pointer register:- content of this register form an
address which defines the top of stack in RAM. Stack is a
Memor
y
Memory units store binary data.
Size of memory determined by the number of
wires in the address bus.
Memory unit consists of large number of storage
cells with each cell capable of storing 0 or 1 bit.
Storage cells grouped into a location
with each location storing a word.
In order to access the stored
word each location is identified by a unique word.
Size of memory specified in terms
of number of memory locations available.
1K is 2^10=1024
4K memory has 4096 locations.
Memory:-
Classification
CMOS Memories
RAM ROM’
s
EPROM EEPROM
Volatile Flash
Content lost when power off
Non-volatile
Content will be kept safely when power off
Memory:-
RAM
Classification
(Random Access Memory):- can be read from or
written to at any time provided power is there.Data is
considered volatile because it is lost when power goes.
ROM (Read Only Memory):- permanent storage of data that
CPU can read but CPU cannot write data on ROM. It does
not require a power supply to retain its data so called non
volatile memory.
PROM(programmable ROM):- is used for ROM chips that
can b e programmed by the user.
EPROM (Erasable & Programmable ROM):- data stored
can b e erased with ultraviolet light through a transparent
window at the top of the EPROM IC then new data can be
stored on the EPROM.
EEPROM (Electrically Erasable & Programmable ROM):-
Uses a special programming pin (usually uses higher voltage)
to erase then write new program.
Input /
Output
Communication to and from the microprocessor
occurs through I/O devices connected to the bus.
External computer peripheral I/O devices are
keyboards, printers, displays, modems, network device.
For Mechatronic applications A/D, D/A and digital
O
/I provides interfaces to switches, sensors and
actuators.
Since the speed and characteristic of the peripheral
devices differ with microprocessor, microprocessor
are connected via an interface chip.
Microprocessor accept valid data from interface
chip which is indicated by the interrupt or polling
(status bit set to 1).
Polling is the process of repeated checking each
peripheral device to see if it is ready to send or accept
a new byte of data.
Microcontrolle
r
The microcontroller contains a
microprocessor, memory, I/O capabilities, and
other on-chip resources.
It is basically a microcomputer on a single IC.
The components of a microcontroller are the:
CPU
RAM and ROM
Digital Input/Output ports
A/D and D/A converters
Timers
Popular microcontrollers that have being in
great demand for realizing mechatronics
systems are:
Microchip's PIC;
Motorola's 68HC11; and
Intel's 8051.
Microcontroller
s
Motorola
M68HC11
Intel
8051
Cont
…software stored in
The CPU executes the
ROM and controls all the microcontroller
components.
The RAM is used to store settings and values used
by a
n executing program.
The ROM is used to store the program and any
permanent data. A designer can have a program and
data permanently stored in ROM by the chip
manufacturer, or the ROM can be in the form of
EPROM or EEPROM, which can be reprogrammed by
the user.
The digital I/O ports allow binary data to be
transferred to and from the microcontroller using
external pins on the IC.
These pins can be used to read the state of
switches and on-off sensors, to interface to external
analog-to-digital (ADC) and digital-to-analog (DAC)
converters, to control digital displays, and to
control on-off actuators.
Cont
… be used to transmit signals
The I/O ports can also
to and from other microcontrollers to coordinate
various functions.
The ADC allows the microcontroller to convert
an external analog voltage (e.g. from a sensor)
to a digital value that can be processed or stored
by the CPU.
The DAC allows the microcontroller to output an
analog voltage to a non-digital device (e.g. a motor
amplifier).
Microcontrollers typically have less than 1 kB to
several tens of kilobytes of program memory,
compared with microcomputers where RAM
memory is measured in megabytes or gigabytes.
Also, microcontroller clock speeds are slower
PIC MICROCONTROLLER
In this course we will discuss the PIC
microcontroller unit (PIC MCU) manufactured by
Microchip Technology, Inc.
There are many other microcontrollers on the market
today (such as those made by Atmel (AVR), Freescale
(HCS12), Intel (MCS-51 family), and Motorola (68HC)).
The PIC microcontrollers are selected due to their
widespread use (several billions of PIC MCUs have been
manufactured so far), low cost, and ease of use.
Cont
…
system
– (We have one mass so only one free body
diagram)
Net Force = F- k× y- c×
• Step 2 : Determine
dy Net force acting on
dt Mass
m y = Net Force = F- k× y- c×
d 2
dy
dt2
• Step 4 : Final Differential Equation
dt
d2 y
m 2 k× y c×
dy
dt F
dt
MECHANICAL SYSTEM BUILDING BLOCKS
ROTATIONAL SYSTEM
– Rotational Dashpot
– Rotational Mass
Example:- Rotational Mechanical System
• Step 1 : Free Body Diagram of system
– (We have one rotational mass so only one free body
diagram)
p ).
2
Capacitance
Cont…
• Hydraulic inertance ( I ) is the
equivalent of inductance in
electrical. To accelerate a fluid a net
force is required and this i s
provided by the pressure differenc e
• Step 1 : combined thermal capacity C, since the energy rate to heat the room
is q1 – q2,
dT
q 1 -q 2 =C dt
• Step 2 : If the temperature inside the room is T and that outside the room To
then substituting for q2 in step 1 gives:
and
q T T0 q1 T T0 C dT
• Step 3 : Final equ2ation R R
dt
dT
RC dt T Rq 1 0
T
~END~