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

Microcontroller Introduction Shaharyar Mahmood

A microcontroller is a computer system contained on a single integrated circuit chip. It contains a CPU, memory, and input/output peripherals. The CPU fetches and executes instructions from program memory in a fetch-decode-execute cycle. Microcontrollers have address buses, data buses, and control buses to connect subsystems. Memory includes RAM, EEPROM, and Flash memory. Ports and serial communication interfaces allow connection to external devices. A crystal oscillator provides the microcontroller's clock signal.

Uploaded by

chusmanullah
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
155 views

Microcontroller Introduction Shaharyar Mahmood

A microcontroller is a computer system contained on a single integrated circuit chip. It contains a CPU, memory, and input/output peripherals. The CPU fetches and executes instructions from program memory in a fetch-decode-execute cycle. Microcontrollers have address buses, data buses, and control buses to connect subsystems. Memory includes RAM, EEPROM, and Flash memory. Ports and serial communication interfaces allow connection to external devices. A crystal oscillator provides the microcontroller's clock signal.

Uploaded by

chusmanullah
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 36

Lecture 2

Microcontroller Introduction
Shaharyar Mahmood
So what exactly is a Microcontroller

 Entire computer system contained within a


single integrated circuit.
 The goal is to choose the most economical
MC that has the desired parameters and
features for the application at hand.

Microprocessor and Interfacing 2


Block Diagram

Microprocessor and Interfacing 3


Basic Architecture
 CPU is a complex sequential circuit whose
primary function is to execute programs that are
stored within its Flash EEPROM.
 A program is a series of instructions to perform a
specific task.
 Program is developed on PC and downloaded
into the MC and MC becomes stand-alone
processing system.
 Fetch-Decode-Execute cycle. CPU is the main
control center for the entire MC. CPU is
managing program execution and
communication with different subsystems.
Microprocessor and Interfacing 4
Software Development Process

Microprocessor and Interfacing 5


CPU Architectures

Microprocessor and Interfacing 6


RISC versus CISC
 There are two basic types of instruction set
architectures: Reduced Instruction Set Computer
(RISC) and Complex Instruction Set Computer
(CISC) Architecture.
 In RISC architecture complex instructions are
built up from basic building block instructions.
 RISC-based instruction architectures lend
themselves to systems with less complex CPU
architectures.
 A CISC-based architecture has a complement of
fuller feature, more complex instructions than the
RISC-based architecture.
Microprocessor and Interfacing 7
Little-endian vs Big-endian
 Endianness has to do Address Value Address Value

with the byte ordering


of multibyte scalar
184 12 184 78
values.
 Suppose we have the
32-bit hexadecimal 185 34 185 56
value 12345678 and
that it is stored in a 186 56 186 34
32-bit word in byte
addressable memory 187 78 187 12
at byte location 184.
Microprocessor and Interfacing Big Endian Small Endian 8
Register Set

Usually all registers associated with a given subsystem are grouped together.
Microprocessor and Interfacing 9
Register Set
 The register set is the interface between you the user
and the different subsystems aboard the microcontroller.
 Each register consists of a collection of flip-flops.
 to set a register called SCI BaudRate to the binary value
1010 1110:
SCI BaudRate = 0xAE;
 Header files contain the “personality data” for a given
microcontroller.
 Specifically, they provide a link between the name of a
specific register used within a program and its location
within the microcontroller.

Microprocessor and Interfacing 10


Bus Structure
 A bus is a collection
of parallel conductors
that have a similar
function. Most MCs
are equipped with an
address bus, a data
bus, and a control
bus.

Microprocessor and Interfacing 11


Address Bus
 The address bus provides a connection between
the central processing unit and the memory
subsystem aboard the microcontroller.
 The number of individually addressable memory
addresses may be determined by evaluating
(2)address lines =addressable locations. E.g. 16 bits
= 65536 (64kB). The first address in this
memory space is (0000)16 while the last address
in this space will be (FFFF)16.

Microprocessor and Interfacing 12


Data Bus
 Used to route parallel data about different
subsystems within the MC. E.g. 4, 8, 16 or
32 bit.
 The width determines the size of a data
argument that the MC can process.
 For example, the largest unsigned integer
that may be stored in a microcontroller
with an eight-bit data path is 255. (2^n)-1.
Microprocessor and Interfacing 13
Control Bus
 Microcontrollers are equipped with paths to send
and receive a collection of control signals
designated as the control bus.
 These signal lines carry control signals to
different subsystems throughout the
microcontroller.
 Some control signals are provided on ports to
connect external components.
 Control signals are issued by the CPU in
response to program instructions to ensure the
instruction is properly executed.

Microprocessor and Interfacing 14


Memory
 The span of addressable memory usually
contains several different types of memory
including Static Random Access Memory
(SRAM), byte-addressable Electrically
Erasable Programmable Read Only
Memory (EEPROM), and bulk
programmable Flash EEPROM.

Microprocessor and Interfacing 15


Memory Map

Microprocessor and Interfacing 16


RAM
 RAM is volatile. That is, if the microcontroller
loses power, the contents of RAM are lost.
 It can be written to and read from during
program execution.
 It is typically used during system development to
store a program. Once development is complete,
the completed program is stored in nonvolatile
memory such as Flash EEPROM.
 Used to store global variables, support dynamic
memory allocation of variables, and to provide a
location for the stack.

Microprocessor and Interfacing 17


Byte-addressable EEPROM
 This type of memory is used to
permanently store and recall variables
during program execution.
 Used for logging critical data and to store
useful information during a power failure.
 Applications include electronic lock
combinations, and automatic garage door
electronic unlock sequences.
Microprocessor and Interfacing 18
Flash EEPROM
 Bulk programmable Flash EEPROM is
used to store programs.
 Flash EEPROM is typically programmed
using In System Programming (ISP)
techniques. That is, a host PC is
connected via a cable to a microcontroller
while it is resident within its application
circuit. The host PC downloads the
program to the microcontroller.
Microprocessor and Interfacing 19
AVR ISP

Microprocessor and Interfacing 20


TIME BASE
 The speed at which a microcontroller
sequences through its actions is controlled
by an external time base.
 The time base may be provided by an
external quartz crystal, a programmable
oscillator, a ceramic resonator, or an
internal time base.

Microprocessor and Interfacing 21


Timing Concepts
 Frequency: Signal frequency is the number of
cycles per second completed by a repetitive
signal. It is expressed in units of Hertz (Hz).
 Period: The period is the time increment in
seconds required for a repetitive signal to
complete a single cycle. The period is the
reciprocal of the frequency (T = 1/ f ).
 Duty cycle: The duty cycle indicates the
percentage of time for which the signal is active
in a single period.
 Pulse width modulation (PWM):PWM signals are
frequently used to control motor speed.
Microprocessor and Interfacing 22
Timing Concepts

Microprocessor and Interfacing 23


Timing Subsystem Applications
 Most microcontrollers are equipped with a multi
channel timing system. The channels within the
timing system may be configured to:
 Measure parameters of input signals such as
period and duty cycle.
 Generate precision output pulses or repetitive
signals.
 Count incoming pulses present in an input
signal.
 Generate PWM signals.
Microprocessor and Interfacing 24
Port Systems
 Ports provide access to
external world.
 8-bit ports along with data-
direction registers.
 Some ports have alternate
functions such as alternate
functions such as analog-to-
digital conversion, serial
communication, and network
interfacing.
 Some have multiplexed
capability such as expansion
ports provided to route
the data and address ports
outside the microcontroller
may employ time multiplexed
features.
Microprocessor and Interfacing 25
Communication Systems
 parallel communication techniques are
used for short distance communication
within and outside of a microcontroller.
 For a long distance communication, a
serial communication technique is used to
send and receive data.

Microprocessor and Interfacing 26


Serial Communications
 Synchronous and Asynchronous
communication.
 The asynchronous communication method uses
a start and stop bit protocol to synchronize a
transmitter and receiver.
 Inexpensive, but the disadvantage is that the
data transmission rates are typically slower than
a synchronous serial communication system due
to its overhead (start and stop bits).
 Referred as UART (universal asynchronous
receiver transmitter) or the SCI (serial
communications interface).
Microprocessor and Interfacing 27
Continued…
 The synchronous serial communication
uses a synchronized clock to send and
receive each bit.
 For a long distance communication, the
synchronous serial communication
technique is not recommended.

Microprocessor and Interfacing 28


Terminology
 Simplex mode: In this mode, the serial
communication is accomplished by transmitting
data in one direction at a time.
 Duplex mode: In this serial communication
mode, data can be transmitted and received
from both ends of the communication link at the
same time.
 BAUD rate: The rate of bits sent or received. It
describes the number of bits communicated per
second.

Microprocessor and Interfacing 29


Terminology Continued…
 ASCII code: The American Standard Code for
Information Interchange code is used in
communication to encode alphabets, numbers,
punctuation, and control characters using a
seven-bit representation. ASCII is a subset of
the international Unicode standard.
 Bit time: The time required to transmit or receive
a single bit.
 Serial line code: A specific encoding mechanism
used to transmit and receive information.

Microprocessor and Interfacing 30


RS-232 Protocol
 The RS-232 standard represents a logic
high with a −10 VDC level and a logic low
with a +10 VDC level.
 These chips are equipped to provide
interfacing for a two way (transmit and
receive) communication system.

Microprocessor and Interfacing 31


Interrupt System

Microprocessor and Interfacing 32


Speed
 Microcontrollers are available in a wide range of
operating speeds.
 In general, you should use the lowest acceptable
speed for a given application.
 This is because that the power consumption of a
microcontroller is directly proportional to its
operational speed. Since many microcontroller
applications are battery powered, conserving
power and hence extending battery life is
essential.

Microprocessor and Interfacing 33


ANALOG-TO-DIGITAL CONVERTER

 This subsystem converts continuously


varying analog signals from the outside
world into a binary representation suitable
for use by the microcontroller.
 These converters commonly have 8–10-bit
resolution.
 Therefore, a continuous signal is
converted to a series of digital snapshots
of the analog signal.
Microprocessor and Interfacing 34
CHOOSING A MICROCONTROLLER FOR A
SPECIFIC DESIGN

Microprocessor and Interfacing 35


The End

Microprocessor and Interfacing 36

You might also like