100% found this document useful (1 vote)
122 views

Unit 3 AdvancedMC

The document provides information about advanced microcontrollers, specifically the PIC16F877 microcontroller. It discusses that the PIC16F877 is a commonly used microcontroller from Microchip with features that make it suitable for various applications. It then describes the architecture of the PIC16F877, including its CPU, memory organization of program memory, data memory, EEPROM, serial communication protocols, interrupts, I/O ports, CCP module, and timers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
122 views

Unit 3 AdvancedMC

The document provides information about advanced microcontrollers, specifically the PIC16F877 microcontroller. It discusses that the PIC16F877 is a commonly used microcontroller from Microchip with features that make it suitable for various applications. It then describes the architecture of the PIC16F877, including its CPU, memory organization of program memory, data memory, EEPROM, serial communication protocols, interrupts, I/O ports, CCP module, and timers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 108

Introduction to Advanced

Microcontroller
Advanced Microcontrollers
• PIC16F877 is one of the advanced and
commonly used Peripheral Interface
Microcontroller from Microchip.
• Simplicity, quality, ease of availability and low
price makes them ideal for different
applications. Also, this PIC features all
components that modern microcontrollers have.
Advanced Microcontrollers – Microchip
Advanced Microcontrollers - Microchip
• None other than Steve Sanghi, the chairman,
president and CEO of Microchip Technology Inc.
• Sanghi moved from India to U.S. to pursue a
Master’s degree at the University of Massachusetts
after bachelor’s degree in engineering, from Punjab
Engineering College.
• In 1993, Sanghi became president and CEO of
Microchip after seeking advice from venture capital
firms on starting his own company.
Advanced Microcontrollers
PICs are popular with both
• industrial developers
• hobbyists alike due to their low cost,
• wide availability,
• large user base,
• extensive collection of application notes,
availability of low cost
• free development tools,
• serial programming (and re-programming with
flash memory) capability.
Advanced Microcontrollers
Microchip PIC microcontrollers are available
in various types.

 First MCU available from General Instruments


in early 1980’
 The micro-controller had a simple processor
executing 12-bit wide instructions with basic I/O
functions.
These devices are known as low-end
architectures.
It limited program memory and are meant for
applications requiring simple interface functions
and small program & data memories.
Advanced Microcontrollers
• Some of the low-end device numbers are
– 12C5XX
– 16C5X
– 16C505
• Mid range PIC architectures
built by upgrading low-end architectures with
more number of peripherals, more number of
registers and more data/program memory.
– 16C6X
– 16C7X
– 16F87X
Advanced Microcontrollers

• One of the mid -range versions of PIC Cs is


PIC16C6x/7x.
• The 7x family has an enhancement of Analog
to Digital converter capability.
• packages. These are available in 28 pin DIP,40
pin DIP ,44 pin surface mount package…etc..
Advanced Microcontrollers
• 6x/7x family of Micro
controllers:
PIC 16C62A and 16C74A
are found with a suffix A.

A indicates the Brown-Out Reset.

Brown-Out Reset which causes a reset of the PIC


when the Power Supply voltage drops below 4.0 V
Advanced Microcontrollers

Program memory type is indicated by an


alphabet.

C = EPROM

F = Flash

RC = Mask ROM
PIC MICROCONTROLLER – 16F877: Salient Features
 Speed : PIC executes most of its instructions in
0.2 s or five instructions per microsecond.
 Instruction set Simplicity : just 35 instructions.
 Integration of operational features:
Power-on-reset and brown-out protection ensure that
the chip operates only when the supply voltage is
within specifications.
 Watch dog timer: resets the PIC if the chip
malfunctions or deviates from its normal operation at
any time.
 Powerful output pin control:
single instruction can select and drive a single
output pin high or low in its 0.2 s instruction
execution time. The PIN can drive a load of up
to 25A.
PIC 16F877: Architecture
PIC 16F877: Architecture
CPU (Central Processing Unit):
PIC microcontroller’s CPU consists of
– Arithmetic logic unit (ALU)
– Memory unit (MU)
– Control unit (CU)
– Accumulator
• ALU is used for arithmetic operations and for logical
decisions. Memory is used for storing the
instructions after processing.
• Control unit is used to control the internal and
external peripherals which are connected to the CPU
and accumulator is used for storing the results.
PIC 16F877: Architecture
MEMORY ORGANIZATION:
PIC microcontroller memory module consists of
mainly 3 types of memories:
• PROGRAM MEMORY:
It contains the written program after we burned it
in microcontroller. Program Counter executes
commands stored in the program memory, one
after the other. Pic microcontroller can have 8K
words x 14 bits of Flash program memory that can
be electrically erased and reprogrammed.
Whenever we burn program into the micro, we
erase an old program and write a new one.
PIC 16F877: Architecture – Memory Organization
PIC 16F877: Architecture – Memory Organization
PIC 16F877: Architecture
DATA MEMORY:
• It is a RAM type which is used to store the data
temporarily in its registers. The RAM memory is
classified into banks. Each bank extends up to 7Fh
(128 bytes).
• Number of banks may vary depending on the
microcontroller.
• PIC16F8X has only two banks. Banks contain Special
Function Registers (SFR) and General Purpose
Registers (GPR).
• The lower locations of each bank are reserved for
the Special Function Registers and upper locations
are for General Purpose Registers.
PIC 16F877: Architecture – DATA MEMORY
General Purpose Registers (GPR):
• These registers don’t have any special function. These are
used for general purpose for multiplying, addition or
subtraction and then storing the results in other registers.
CPU can easily access the data in these registers.
Special Function Registers (SFR):
• These registers are used for special purposes and
they cannot be used as normal registers. Their function is
set at the time of manufacturing. They perform the
function assigned to them and user cannot change the
function of SFR.
Three important SFRs for programming are:
• STATUS register: It changes the bank
• PORT registers: It assigns logic values 0 or 1 to the ports
• TRIS registers: It is a data direction register for input and
output.
PIC 16F877: Architecture – DATA EEPROM
DATA EEPROM or Flash:
• This memory allows storing the variables as a
result of burning the written program. It is
readable and writable during normal operation.
• This memory is not directly mapped in the
register file. It is indirectly addressed through the
SFRs.
• There are six SFRs which are used to read and
write to this memory (EECON1, EECON2, EEDATA,
EEDATH, EEADR, EEADRH).
PIC 16F877: Architecture – Serial Communication
• The transfer of one bit of data at time
consecutively over a communication channel is
called Serial Communication.
There are three protocols of serial communication:
• USART: Universal synchronous and Asynchronous
Receiver and Transmitter
• SPI Protocol: SPI stands for Serial Peripheral
Interface.
• I2C Protocol: I2C stands for Inter Integrated
Circuit.
PIC 16F877: Architecture – Serial Communication
PIC 16F877: Architecture – Serial Communication
USART:
• It stands for Universal synchronous and
Asynchronous Receiver and Transmitter which
provides a serial communication in two
devices.
• In this protocol data is transmitted and
received bit by bit through a single wire
according to the clock pulses.
• To send and receive data serially the PIC
microcontroller has two pins TXD and RXD.
PIC 16F877: Architecture – Serial Communication
SPI Protocol:
• SPI stands for Serial Peripheral Interface. It is
used to send data between PIC microcontrollers
and other peripherals like sensors, shift
registers and SD cards.
• Three wire SPI communications is supported in
PIC microcontroller between two devices on a
common clock source.
• SPI protocol has greater data handling
capability than that of the USART.
PIC 16F877: Architecture – Serial Communication
I2C Protocol:
• I2C stands for Inter Integrated Circuit, and this
protocol is used to connect low speed devices
like microcontrollers, EEPROMS and A/D
converters.
• PIC microcontroller support two wire Interface
or I2C communication between two devices
which can work as both Master and Slave
device.
PIC 16F877: Interrupts

• There are 20 internal interrupts and three


external interrupt sources in PIC
microcontrollers which are related with
different peripherals like ADC, USART, Timers,
and CCP etc.
PIC 16F877: I/O PORTS
Let us take PIC16 series, it consists of five ports, such as Port A, Port
B, Port C, Port D and Port E.
• Port A:This port is 7-bit wide and can be used for both input and
output. The status of TRISA register decided whether it is used as
input or output port.
• Port B:It is an 8-bit port. This port also can be used as input and
output. Moreover in input mode four of its bits are variable
according to the interrupt signals.
• Port C:It is also an 8-bit port and can be used as both input and
output port which is determined by the status of the TRISC
register.
• Port D:This 8-bit port, unlike Port A, B and C is not an
input/output port, but is used as acts as a slave port for the
connection to the microprocessor When in I/O mode Port D all
pins should have Schmitt Trigger buffers.
• Port E:It is a 3-bit port which is used as the additional feature of
the control signals to the A/D converter.
PIC 16F877: CCP Module
A CCP module works in the following three modes:
• Capture Mode: In this mode time is captured
when a signal is arrived, or we can say that,
when the CCP pin goes high it captures the value
of the Timer1.
• Compare Mode: It works same as an analog
comparator, which means that when timer 1’s
value reaches some reference value it will give
an output signal.
• PWM Mode: This mode provides a 10 bit
resolution pulse and duty cycle that is
programmable.
PIC 16F877: TIMERS
• Timers and counters are important as timers
can tell the time and count. PIC microcontroller
can have up to four timers (depending upon
the family) Timer0, Timer1, Timer2 and Timer3.
Timer0 and Timer2 are of 8-bits while the
Timer1 and Timer3 are of 16-bits and 8-bits
based on mode selection, which can also be
used as a counter.
• These timers work according to the selected
modes.
PIC 16F877: BUS
• BUS is used to transfer & receive the data from
one peripheral to another. It is categorized into
two types like data bus and address bus.
• Data Bus is used to transfer or receive the data.
• The address bus is used to transfer the memory
address from the peripherals to the central
processing unit.
• Input/Output pins are used to interface the
exterior peripherals; both the UART & USART
are serial communication protocols, used to
interface with serial devices such as GPS, GSM,
IR, Bluetooth, etc.
PIC 16F877: BUS
PIC 16F877: A/D CONVERTER
• It converts the analog voltage levels to digital
voltage values.
• In PIC Microcontroller, ADC has 8-channels and
has resolution of 10-bit, which means that if
we have to convert an analog voltage between
0V to 5V the converter will divide it to 2^10
levels (1024 levels).
• The special function registers ADCON0 and
ADCON1 control the operation of ADC.
PIC 16F877: A/D CONVERTER

The converter stores the lower 8 bits in ADRESL


register and the upper bits in the ADRESH register.
Reference voltage of 5V is required for the operation
of the converter.
PIC 16F877: D/A CONVERTER
• There are no analog outputs in PIC
Microcontroller.
• To get analog output we have to use external
Digital-to-Analog Converter (DAC).
• It can convert 8 bits of digital number from the
eight digital outputs of PIC microcontroller.
PIC 16F877: On-Chip ADC
• Most of the Microcontroller projects will involve an ADC
(Analog to Digital converter) in it, because it is one the
most used ways to read data from the real world.
• Almost all the sensors like temperature sensor, flux
sensor, pressure sensor, current sensors, voltage sensors,
gyroscopes, accelerometers, distance sensor, and almost
every known sensor or transducer produces an analog
voltage of 0V to 5V based on the sensors reading.
• A temperature sensor for instance may give out 2.1V
when the temperature is 25C and go upto 4.7 when the
temperature is 60C.
• In order to know the temperature of the real world, the
MCU has to just read the output voltage of this
temperature sensor and relate it to the real world
temperature.
PIC 16F877: On-Chip ADC
• The most common types of ADCs are flash,
successive approximation, and sigma-delta.
• The type of ADC used in PIC16F877A is called as
the Successive approximation ADC or SAR in
short. So let’s learn a bit about SAR ADC before
we start using it.
• The SAR ADC works with the help of a comparator
and some logic conversations.
• This type of ADC uses a reference voltage (which
is variable) and compares the input voltage with
the reference voltage using a comparator and
difference, which will be a digital output, is saved
from the Most significant bit (MSB).
PIC 16F877: On-Chip ADC
• The PIC we are using has 10-bit 8-channel ADC.
This means the output value of our ADC will be 0-
1024 (2^10) and there are 8 pins (channels) on
our MCU which can read analog voltage.
• The value 1024 is obtained by 2^10 since our ADC
is 10 bit.
• The eight pins which can read the analog voltage
are mentioned in the datasheet.
• The analog channels AN0 to AN7 are highlighted
for you. Only these pins will be able to read analog
voltage. So before reading an input voltage we
have to specify in our code which channel has to
be used to read the input voltage.
PIC 16F877: On-Chip ADC
PIC 16F877: On-Chip ADC
The A/D module has four registers which has to
be configured to read data from the Input pins.
These registers are:
• A/D Result High Register (ADRESH)
• A/D Result Low Register (ADRESL)
• A/D Control Register 0 (ADCON0)
• A/D Control Register 1 (ADCON1)
PIC 16F877: CCP MODULE
• Capture-Compare-Pulse-Width-Module (CCP) is
a special module designs for modulation and
waveform generation applications.
• This module basically works on three different
modes (capture/compare and PWM odes). The
PIC 16F877 chip contains two CCP ports (CCP1
and CCP2). Each of this CCP module contains
16 bit registers which works as,
– 16-bit Capture register
– 16-bit Compare register
– PWM Master/Slave Duty Cycle registers
PIC 16F877: CCP MODULE
• The CCP1 and CCP2 modules are identical in its
operation except in its special event trigger
operation. In each CCP modules, the capture,
compare and PWM modes using different
timer resources.
PIC 16F877: CCP MODULE
PIC 16F877: PWM MODULE
• In Pulse Width Modulation mode, the CCPx pin
produces up to a 10-bit resolution PWM
output. Since the CCP1 pin is multiplexed with
the PORTC data latch, the TRISC<2> bit must be
cleared to make the CCP1 pin an output.
I2C – Protocol bus
• A I2C bus is a bidirectional two-wired serial bus
which is used to transport the data between
integrated circuits. The I2C stands for “Inter
Integrated Circuit”.
• It was first introduced by the Philips
semiconductors in 1982.
• The I2C bus consists of three data transfer
speeds such as standard, fast-mode and high-
speed-mode.
• The I2C bus supports 7-bit and 10-bit address
space device and its operation differ with low
voltages.
I2C – Protocol bus
• The I2C is a serial bus protocol consisting of two
signal lines such as SCL and SDL lines which are
used to communicate with the devices.
• The SCL stands for a ‘serial clock line’ and this
signal is always driven by the ‘master device’.
• The SDL stands for the ‘serial data line’, and this
signal is driven by either the master or the I2C
peripherals.
• Both these SCL and SDL lines are in open-drain
state when there is no transfer between I2C
peripherals.
I2C – Protocol bus

Open-Drain Outputs
The open-drain is the concept for FET transistor wherein the drain
terminal of the transistor is open state.
The SDL and SCL pins of the master device are designed with the
transistors in open state, so data transfer is possible only when these
transistors are conducted.
Hence, these lines or drain terminals are connected thorough pull-up
resistors to VCC for conduction mode.
I2C – Protocol bus
I2C Interfaces
• Many slave devices are interfaced to the
microcontroller with the help of the I2C bus
through I2C level shifter IC for transferring the
information between them.
• The I2C protocol used to connect a maximum of
128 devices that are all connected to
communicate with the SCL and SDL lines of the
master unit as well as the slave devices.
• It supports Multi-master communication, which
means two masters are used to communicate the
external devices.
I2C – Protocol bus
I2C – Protocol bus
The I2C protocol operates three modes such as:
• fast mode - 0Hz to 400 KHz speed
• high-speed mode - 10 KHz to 100KHz and
• standard mode wherein the standard mode
data speed ranges 0Hz to 100Hz, .
• The 9-bit data is sent for each transfer wherein
8-bits are sent by the transmitter MSB to LSB,
and the 9th bit is an acknowledgement bit sent
by the receiver.
I2C – Communication
• The I2C bus protocol is most commonly used in
master and slave communication wherein the
master is called “microcontroller”, and the slave
is called other devices such as ADC, EEPROM,
DAC and similar devices in the embedded
system.
• The number of slave devices is connected to the
master device with the help of the I2C bus,
wherein each slave consists of a unique address
to communicate it.
I2C – Communication
The following steps are used to communicate the master device to the
slave:

• Step1: First, the master device issues a start condition to inform all
the slave devices so that they listen on the serial data line.
• Step2: The master device sends the address of the target slave device
which is compared with all the slave devices’ addresses as connected
to the SCL and SDL lines. If anyone address matches, that device is
selected, and the remaining all devices are disconnected from the SCL
and SDL lines.
• Step3: The slave device with a matched address received from the
master, responds with an acknowledgement to the master thereafter
communication is established between both the master and slave
devices on the data bus.
• Step4: Both the master and slave receive and transmit the data
depending on whether the communication is read or write.
• Step5: Then, the master can transmit 8-bit of data to the receiver
which replies with a 1-bit acknowledgement.
ARM7 – LPC2148
LPC2148 - Introduction
• The ARM7 is a 32-bit general purpose microprocessor,
and it offers some of the features like little power
utilization, and high performance. The architecture of
an ARM is depended on the principles of RISC.
• The Pipeline method is used for processing all the
blocks in architecture.
• In general, a single instruction set is being performed,
then its descendant is being translated, & a 3rd-
instruction is being obtained from the memory.
• An exclusive architectural plan of ARM7 is called as
Thumb, and it is perfectly suitable for high volume
applications where the compactness of code is a
matter.
Versions of ARM
LPC2148 - Introduction
Hdsdh
Kjd
LPC2148 need minimum below listed hardware to
work properly.
• 1. Power Supply
• 2. Crystal Oscillator
• 3. Reset Circuit
• 4. RTC crystal oscillator (This is not necessary if
you are not using RTC. However this is considered
as necessary requirement)
• 5.UART
• Transformer: It is used to step down 230V AC to
9V AC supply and provides isolation between
power grids and circuit.
• Rectifier: It is used to convert AC supply into DC.
• Filter: It is used to reduce ripple factor of DC
output available from rectifier end.
• Regulator: It is used to regulate DC supply
output.
LPC2148 – Serial Communication
• These microcontrollers include two UARTs for
standard transmit & get data-lines.
• Contrasted to earlier microcontrollers
(LPC2000), UARTs in microcontrollers LPC2141/
LPC2142/ LPC2144/ LPC2146/ LPC2148 initiate a
partial baud rate generator used for both UARTs,
allowing these types of microcontrollers for
achieving typical baud rates like 115200 by
every crystal frequency over 2 MHz.
• Additionally, the control functions like CTS/RTS
are completely executed in hardware.
LPC2148 – Serial Communication
LPC2148 – Serial Communication
Introduction to ARM Microcontroller
• The ARM stands for Advanced RISC machine and it is a
32-bit reduced instructions set computer (RISC)
microcontroller. It was first introduced by the Acron
computers’ organization in 1987.
• The ARM is a family of the microcontroller developed
by the different manufacturers such as ST
microelectronics, Motorola and so on.
• The ARM cortex microcontroller is an advanced
microcontroller in the ARM family, which is developed
by the ARMv7 architecture. The ARM cortex family
divided into three sub-families such as;
– ARM-Cortex Ax-series
– ARM-Cortex Rx-series
– ARM-Cortex Mx-series
Introduction to ARM Microcontroller
Introduction to ARM Microcontroller
gdgdgdgd
ggdgggdg
g
Introduction to ARM Microcontroller
gdgdgdgdgg
dgggdgg
Introduction to ARM Microcontroller
gdgdgdgdgg
dgggdgg
ARM Microcontroller – Processor Modes
gdgdgdgdgg
dgggdgg222
2
ARM Microcontroller – Register organization
gdgdgdgdgg
ARM Microcontroller – Pipelining structure
gdgdgdgdgg
dgggdgg222
ARM Microcontroller – Pipelining structure
ARM Microcontroller – Interrupts
gdgdgdgdgg
dgggdgg222
ARM Microcontroller – Exception Handling
ARM Microcontroller – Exception Handling
gdgdgdgd
ggdgggdg
g
ARM Microcontroller – Applications
• Innovation and consumer demand for new
experiences are driving mobile technology trends
and challenging companies to produce always-on,
always-connected 5G-ready devices.
• Consumers want a range of mobile devices, from
smartphones to laptops to PCs, that must feature
immersive computing, with powerful artificial
intelligence (AI), augmented reality (AR), virtual
reality (VR), and machine learning capabilities.
Arm offers a broad range of IP to enable
developers, SiPs and OEMs to meet these
increasingly complex requirements.
Serial Peripheral Interface - SPI
• The Serial Peripheral Interface (SPI) is a bus interface
connection protocol originally started by Motorola Corp.

• SPI Interface uses four wires for communication. Hence it is


also known as four wire serial communication protocol.
• SPI is a full duplex master-slave communication protocol.
This means that only a single master and a single slave can
communicate on the interface bus at the same time.
• SPI enabled devices work in two basic modes of SPI
operation i.e. SPI Master Mode and SPI Slave Mode.
• Master Device is responsible for initiation of communication.
• Master Device generates Serial Clock for synchronous data
transfer.
• Master Device can handle multiple slave devices on the bus
by selecting them one by one.
Serial Peripheral Interface - SPI
• MISO (Master In Slave Out)
Out from Slave.
Master receives data and slave transmits data
through this pin.
• MOSI (Master Out Slave In)
Out from Master.
Master transmits data and slave receives data
through this pin.
• SCK (Serial Clock)
Out from Master.
Master generates this clock for synchronized data
transfer.
Only master can initiate serial clock.
• SSEL (Slave Select)
Out from Master.
Serial Peripheral Interface - SPI
• When you connect a microcontroller to a sensor,
display, or other module, do you ever think about
how the two devices talk to each other? What
exactly are they saying? How are they able
to understand each other?
• Communication between electronic devices is like
communication between humans. Both sides need to
speak the same language. In electronics, these
languages are called communication protocols.
• three most common protocols: Serial Peripheral
Interface (SPI), Inter-Integrated Circuit (I2C), and
Universal Asynchronous Receiver/Transmitter
(UART) driven communication.
Serial Peripheral Interface - SPI
• SPI is a common communication protocol used
by many different devices. For example, SD card
modules, RFID card reader modules, and 2.4
GHz wireless transmitter/receivers all use SPI to
communicate with microcontrollers.
• Devices communicating via SPI are in a master-
slave relationship. The master is the controlling
device (usually a microcontroller), while the
slave (usually a sensor, display, or memory chip)
takes instruction from the master. The simplest
configuration of SPI is a single master, single
slave system, but one master can control more
than one slave (more on this below).
Serial Peripheral Interface - SPI
Serial Peripheral Interface - SPI
Serial Peripheral Interface - SPI
SLAVE SELECT
• The master can choose which slave it wants to
talk to by setting the slave’s CS/SS line to a low
voltage level. In the idle, non-transmitting
state, the slave select line is kept at a high
voltage level.
• Multiple CS/SS pins may be available on the
master, which allows for multiple slaves to be
wired in parallel. If only one CS/SS pin is
present, multiple slaves can be wired to the
master by daisy-chaining.
Serial Peripheral Interface - SPI
Serial Peripheral Interface - SPI
Serial Peripheral Interface - SPI
Serial Peripheral Interface - SPI
Serial Peripheral Interface - SPI

You might also like