Unit 3 AdvancedMC
Unit 3 AdvancedMC
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.
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 25A.
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
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.