Micro Controller
Micro Controller
• Serial communication implies sending data bit by bit over a single wire Many popular serial
communication standards exist—some examples are:
– Asynchronous
Add: Start, Stop, Parity Bits Remove: Start, Stop, Parity Bits
Transmitter + – Receiver
Data
Shifts the parallel data onto Extracts the data using its own
the serial line using its own clock
clock
Converts the serial data back to
Also adds the start, stop and the parallel form after stripping
parity check bits off the start, stop and parity bits
prep by Temesgen Yisehak (Lt.Col) 6
Asynchronous Serial Communication
Start Bit Parity Bit 1 or 2 Stop Bits
D0 D1 D2 D3 D4 D5 D6 D7
1 Asynchronous Byte
• Input devices
• Output devices
• Temperature • Frequency
• Humidity • Flow
• Light • Pressure
• Acceleration • Torque
• Force • Proximity
• Displacement
Components Needed
24
Embedded system
• Embedded system is an electronic system, which includes a
single chip microcomputers(Microcontrollers).
• It is configured to perform a specific dedicated application
.Software is programmed into the on chip ROM of
the single chip computer. This software is not accessible to
the user , and software solves only a limited range of
problems .Here the microcomputer is embedded or hidden
inside the system.
• Every embedded microcomputer system , accepts inputs,
performs computations, and generates outputs and runs
in “real time.”
Characteristics of an Embedded
System :
The important characteristics of an embedded system are
Application layer
Physical Layer
Embedded software architectures
• Simple control loop
– software simply has a loop. The loop calls subroutines, each of which
manages a part of the hardware or software.
• Interrupt controlled system
– tasks performed by the system are triggered by different kinds of
events. (e.g. a timer, or by a serial port controller receiving a byte)
– Usually there is a simple task in a main loop also. The tasks performed
in the interrupt handlers should be as short as possibl
– Some times longer tasks are added to a queue structure
• Cooperative multitasking
– A nonpreemptive multitasking system is very similar to the simple
control loop scheme, except that the loop is hidden in an API. (usually
called "pause", "wait", "yield", etc.).
– The advantages and disadvantages are very similar to the control loop,
except that adding new software is easier.
Sampled-data control system
• Sampling refers to the process of converting an
analog signal from a continuously valued range of
amplitude values to one of a finite set of possible
numerical values.
• There are two aspects of a sampled signal:
sampling in time and
quantization in amplitude.
Networked Control System (NCS)
• A Networked Control System (NCS) is a control system wherein the control
loops are closed through a communication network. The defining feature of
an NCS is that control and feedback signals are exchanged among the
system's components in the form of information packages through a
network.
• The functionality of a typical NCS is established by the use of four basic
elements:
Sensors, to acquire information,
Controllers, to provide decision and commands,
Actuators, to perform the control commands and
Communication network, to enable exchange of information.
• The most important feature of a NCS is that it connects cyberspace to
physical space enabling the execution of several tasks from long distance.
• In addition, networked control systems eliminate unnecessary wiring
reducing the complexity and the overall cost in designing and implementing
the control systems. They can also be easily modified or upgraded by adding
sensors, actuators and controllers to them with relatively low cost and no
major changes in their structure.
Sampling
Most input signals to an electronic system start out as analog signals. For
processing, the signal is normally converted to a digital signal by sampling the
input.
Before sampling, the analog
input must be filtered with a
low-pass anti-aliasing filter.
Analog
The filter eliminates input
signal
Sampling
circuit
frequencies that exceed a
certain limit that is Sampling
pulses
Sampled
version of
input signal
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Aliasing
• Digital sampling of any signal, whether sound,
digital photographs, or other, can result in apparent
signals at frequencies well below anything present
in the original. Aliasing occurs when a signal is
sampled at a less than twice the highest frequency
present in the signal. If an audio signal of .
containing a ultrasonic 45 kHz tone is sampled at
44.75 kHz, the resulting signal contains a 0.25 kHz
tone, approximately middle C!
Cont….
• The figure illustrates what happens if
a signal is sampled at regular time
intervals that are slightly less often
than once per period of the original
signal.
• The blue curve is the original signal,
and the red dots indicate the
sampled values.
• The red dots are what are recorded,
since they represent the signal
values at the times the signal is
sampled. The pattern of the red dots
is a terrible representation of the
signal. The red sampled data looks
like a sine wave at about one-tenth
the frequency of the original. This is
aliasing.
Anti-aliasing Filter
To understand the need for an anti-aliasing filter, you need to understand the
sampling theorem which essentially states:
If the signal is sampled less than this, the recovery process will
produce frequencies that are entirely different than in the original
signal. These “masquerading” signals are called aliases.
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Anti-aliasing Filter
The anti-aliasing filter is a low-pass filter that limits high frequencies in the
input signal to only those that meet the requirements of the sampling
theorem.
Ant aliasing is the application of techniques that reduce or eliminate aliasing.
Filtered
Unfiltered
analoganalog Sampling frequency
frequency
frequency
spectrum
spectrum spectrum
f
fc fsample
Overlap causes
aliasing error
The filter’s cutoff frequency, fc, should be less than ½ fsample.
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Analog-to-Digital Conversion
To process naturally occurring analog quantities with a digital system, the analog
signal is converted to digital form after the anti-aliasing filter.
10 V
A positive half-wave from 0-10 V is
shown in blue. The sample-and-
hold circuit produces the staircase
representation shown in red.
0V
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Anti-aliasing Filter
Most signals have higher frequency harmonic and noise. For most ADCs, the
sampling and filter cutoff frequencies are selected to be able to reconstruct
the desired signal without including unnecessary harmonics and noise.
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Low Pass Filters – I
• Signals are often contaminated by high-frequency noises that need to be
removed.
• The following is a simple two-stage active filter:
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Many ICs can perform both functions on a single chip and include
two or more channels. For audio applications, the AD1871 is an
example of a stereo audio ADC.
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Analog-to-Digital Conversion Methods
+VREF
Op-amp
R comparators
Input from +
sample- –
and-hold
R + Priority
– encoder
+ 1
input with reference voltages. Flash – 0 EN
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Analog-to-Digital Conversion Methods
One option for the sigma-delta method is to count the one-bit quantized
output for a set interval. The output of the counter is latched with the parallel
binary code.
Summing
point
Analog + ∆ 1-bit n-bit Binary code
input Σ Integrator
quantizer counter
Latch
output
signal – . .
. .
. .
. .
. .
1-bit
DAC
Sigma-delta ADCs can have high resolution and have advantages for
rejecting noise signals (such as 60 Hz power line interference). They
are available in ICs with internal programmable amplifiers. For these
reasons, they are widely used in instrumentation applications.
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Digital-to-Analog Conversion Methods
Binary-weighted-input DAC:
The binary-weighted-input DAC is a basic DAC in which the input current in
each resistor is proportional to the column weight in the binary numbering
system. It requires very accurate resistors and identical HIGH level voltages for
accuracy.
LSB 8R
D0 Rf
The MSB is represented by the + –
I0
4R If
largest current, so it has the D1
smallest resistor. To simplify I1 – Vout
2R
analysis, assume all current D2 I=0
+ Analog
goes through Rf and none into R
I2
output
the op-amp. D3
MSB I3
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Digital-to-Analog Conversion Methods
60 kW 10 kW
0V
30 kW
–
+3.0 V Vout
+
15 kW
+3.0 V
I out ( I 0 I1 I 2 I 3 )
3.0 V 3.0 V 3.0 V
0 V 0.325 mA
120 kW 30 kW 15 kW
Vout = Iout Rf = (−0.325 mA)(10 kW) = −3.25 V
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Digital-to-Analog Conversion Methods
R-2R ladder:
The R-2R ladder requires only two values of resistors. By calculating
a Thevenin equivalent circuit for each input, you can show that the
output is proportional to the binary weight of inputs that are HIGH.
VS
Each input that is HIGH contributes to the output: Vout n i
2
where VS = input HIGH level voltage
n = number of bits Inputs
i = bit number D0 D1 D2 D3
For accuracy, the resistors R1 R3 R5 R7 Rf = 2R
must be precise ratios, 2R 2R 2R 2R
R2 R4 R6 R8
which is easily done in –
integrated circuits. 2R R R R Vout
+
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Digital-to-Analog Conversion Methods
R1 R3 R5 R7 Rf = 50 kW
50 kW 50 kW 50 kW 50 kW
R2 R4 R6 R8
–
50 kW 25 kW 25 kW 25 kW Vout
+
VS
Apply Vout to all inputs that are HIGH, then sum the results.
2 n i
5V 5V
Vout ( D0 ) 40 0.3125 V Vout ( D1 ) 41 0.625 V
2 2
5V
Vout ( D3 ) 43 2.5 V Applying superposition, Vout = −3.43 V
2
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Resolution and Accuracy of DACs
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Assignment
APPLICATION OF MICROCOMPUTER SYSTEM
1. Motion Control
- Dc motor ………………… group 1
- Induction ………………….group 2
Introduction
Operation
Mathematical relation
Using pIc17f877a microcontroller show the forward and
reverse running in simulation.
Why we use for industrial application.