Microcontroller - PPT 2. 2020

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 13

Lecture 3

Microcontrollers
M.MUNYARADZI
2020
CT215
Microprocessors
• A microprocessor is the integration of a number of useful functions
into a single IC package. These functions include the ability to
execute a stored set of instructions to carry out user defined tasks.
The ability to be able to access external memory chips to both read
and write data from and to the memory.
• . Microprocessors are the central processing unit that controls the
data flow within the memory components and peripherals in
computer systems. Microprocessors require additional integrated
circuits such as memory modules, input-output devices, timers and
analog-to-digital converters to perform the functions required in a
computer. Microprocessors are programmed using an assembly
language which, in the case of the 8085, consisted of 124
instructions. The later versions use many hundreds of instructions
Microcontrollers
• Its use is so widespread that it is almost impossible to work in
electronics without coming across it.  All modern electronic
appliances have a microcontroller in the circuitry.
• Basically, a microcontroller is a device which integrates a number of
the components of a microprocessor system onto a single
microchip. So a microcontroller combines onto the same silicon
chip:
• The CPU core
• Memory (both ROM and RAM)
• Some parallel digital I/O
• Timer
• Analog-to-digital converter
• The programming of microcontrollers is simplified be the use of RIS
or reduced instruction set architecture requiring only 30 to 40
instructions. The PIC16F872 uses 35 instructions.
A single chip microcontroller
• The heart of the
microcontroller is the central
processing unit or CPU. 
• The original microcontrollers,
designed by Texas
Instruments has traditionally
been based on an 8-bit
central processing unit.  For
example, Motorola uses a
basic 6800 CPU core in their
6805/6808 microcontroller
devices. In recent years,
microcontrollers have been
developed around specifically
designed CPU cores for
example, the Microchip PIC
range of microcontrollers.
APPLICATIONS OF
MICROCONTROLLERS
• Engine management systems in automobiles.
• Keyboard of a PC.
• Electronic measurement instruments (such as digital multimeters
and oscilloscopes)
• Printers, scanners, fax machines, photocopiers.
• Mobile phones. digital cameras, GPS units, hearing aids.
• Televisions, radios, CD players, tape recording equipment., and
remote control units
• Environmental monitors, microwave ovens, washing machines,
sewing machines
• Security alarm systems, fire alarm systems, and building services
systems.
• As an exercise, count the number of devices in your home that may
operate on a microcontroller.
Memory in a Microcontroller
• Typically, the amount of ROM type
memory will vary between around
512 bytes and 4096 bytes,
although some 16 bit Address bus
microcontrollers such as the
Hitachi H8/3048 can have as Memory
much as 128 Kbytes of ROM type device

memory.
Micro-
• ROM type memory, is used to processor Data bus
store the program code. ROM
memory can be either OTP (One
Time Programmable memory), read
EPROM, or EEPROM. The
PIC16F872 has 2048 bytes of
EEPROM program space. write

• The PIC16F872 has 128 bytes of


data space and is used for
temporary storage of data which
may be changed during the
operation of the program.
Read-only Memory, ROM

• Microcontrollers use ROM to hold the program code, which is intended to be


executed whenever the system is switched on. There are basically three types
of ROM: OTP ROM, EPROM and EEPROM.
• Erasable Programmable Read Only Memory (EPROM).

• Electrically Erasable Programmable Read Only Memory (EEPROM).


• They are not fitted with a window and cannot be affected by UV light.
Microcontrollers that use EEPROM are generically known as field-
programmable devices. Microchip devices have the letter F in the name, e.g.
the PIC16F872, used in this course, is a field-programmable device and can be
erased and reprogrammed several times. This makes it ideal as a learning tool.
• Random Access Memory (RAM)
• RAM memory is used to store dynamic data (that will change during the
operation of the program).
• So a typical microcontroller system will contain both ROM (could be EPROM,
EEPROM, or ROM) to store the program code, and RAM to store dynamic data.
The I/O Ports
• The digital I/O ports are the means
by which the microcontroller
interfaces to the environment.
• Digital I/O tends to be grouped into
byte wide ports (8 digital bits) that
can be configured as either input
bits or output bits.  There are some
exceptions, such as the microchip
PIC 16C54 with one 6-bit RA port and
a byte wide RB port.
• The number of I/O port bits varies,
depending upon the size of the
microcontroller.  Some very simple 8
bit microcontroller have as few as 4
bits of I/O, whilst those at the high
end range can have as many as 33
bits of I/O (some 16 bit
microcontrollers could have around
78 bits of I/O).
• A typical interface might look like the
one illustrated in figure
Microcontroller ports: LEDs ,relays,
input state of switches and logic
circuit inputs
Timer Input/output Example

• The inputs allow the timer to be used to measure the time of an


input signal applied to the timer input. The microcontroller counts the
number of pulses over a unit of time to determine the speed of
rotation.
• For output,rotating shaft produces a single pulse every revolution.
The microcontroller measures the time taken for a complete
The timer unit used for generating a
delay
• In figure,LED prior to being
turned on via the port bit PB0. 
• Just prior to turning on the
LED, the timer unit is loaded
with a count value (the actual
value being dictated by the
delay time required).
• In due course the timer unit
count value will reach zero, at
which point a flag bit will be
set.
• The CPU, on seeing the flag
bit set, will turn the LED off.
• The time taken for the timer
unit to decrement the count
value to zero will be the time
that the LED is on.
The Serial Port
• A serial interface is a convenient way
to connect to other systems
• Some microcontrollers have a serial
port to allow data to be transmitted to
another microcontroller, PC or remote
system via a two wire pair.   
• A disadvantage can be the slower
speed of data transfer that a serial
port has over a byte wide parallel
data port. 
• The serial port is usually referred to
as a Serial Communications Interface
(SCI). 
• It should be pointed out that the logic
levels from a SCI port are TTL. 
• Therefore, if the microcontroller is to
be connected to a PC, a TTL to RS232
interface chip is required to convert
the signal levels from TTL to RS232
levels. 
• A corresponding RS232 to TTL
interface chip is included in the PC to
perform the necessary signal level
translation back to TTL levels for the
UART chip used in the PC
Analogue to Digital Conversion
• Most 8 bit microcontrollers have
limited performance due to the limited
ADC resolution and CPU performance.
• They are restricted to simple data
logging and measurement
applications not requiring high
precision. Most 8 bit
microcontrollers are unable to
perform complex calculations owing
to their limited instruction set and
speed. 
• In the figure, a microcontroller is
being used to measure an analogue
signal level and determine hi/low
limits.
• The microcontroller includes an
ADC module and one of its digital
input ports has been configured (by
software) to be an analogue input
channel.
• The software running on the
microcontroller will perform an
Analogue to Digital conversion of
the input signal, then determine
whether the input signal is above or
below some pre-defined limit. 

You might also like