SlideShare a Scribd company logo
1 of 39
Download to read offline
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
1
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
Microcontroller’s
Introduction
 A microcontroller is a Dedicated Programmable Low Cost, integrated circuit(IC)
that contains a processor core(CPU), memory (RAM, ROM), and programmable
input/output peripherals (ADC, Counter etc.) designed to perform particular task.
 Microcontroller is a combination of two words micro and controller, Micro means
small in size and controller means a device that can control the operation of any system.
So we can say that a microcontroller is a microprocessor with integrated peripherals.
 It is designed to be embedded into various systems and devices to control their
operation.
 Microcontrollers are widely used in electronic appliances, automotive systems,
industrial automation, robotics, and many other applications where control and
automation are required.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
2
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
Difference Between Microprocessor and Microcontroller
Feature Microprocessor Microcontroller
Functionality Primarily designed for general-purpose
computing, handling complex tasks.
Specialized for embedded systems,
typically for specific applications or tasks.
Integration Central Processing Unit (CPU) is the
primary focus, with external components
added as needed.
Integrated CPU, memory, and peripherals
on a single chip.
Purpose Used in computers, workstations,
servers, and high-level computing
applications.
Designed for embedded systems, consumer
electronics, and specific control
applications.
Cost Tends to be more expensive due to
higher processing power and general-
purpose nature.
Often more cost-effective, tailored to
specific applications, and includes
necessary components.
Power
Consumption
May consume more power due to higher
processing capabilities.
Typically designed for low-power
consumption, suitable for battery-powered
applications.
Memory External memory is required for program
storage and data handling.
Often includes built-in Flash memory for
program storage and RAM for data
handling.
Peripheral
Support
Limited on-chip peripherals; external
components added as needed.
Integrates a variety of on-chip peripherals
like timers, ADC, GPIO, and
communication interfaces.
Complexity Generally more complex due to broader
functionality.
Simpler design, focused on specific tasks,
reducing overall complexity.
Examples Intel Core series, AMD Ryzen series. PIC Microcontrollers, AVR
Microcontrollers, ARM Cortex-M series.
Application
Examples
Personal computers, servers, high-level
computing systems.
Embedded systems, IoT devices, consumer
electronics, control systems.
Development
Environment
Typically uses high-level programming
languages.
Often programmed in lower-level languages
for resource efficiency.
Real-Time
Operation
May not be optimized for real-time
operation.
Often designed with real-time capabilities
for control applications.
Clock Speed Generally operates at higher clock
speeds.
Operates at moderate to lower clock speeds
depending on the application.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
3
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
Advantages - High processing power for multitasking
and resource-intensive applications.
- Versatility for diverse computing tasks.
- Integrated design saves space and cost.
- Low power consumption for battery-
operated devices.
- Real-time capabilities for control
applications.
Disadvantages - Higher cost and power consumption.
- Overkill for many embedded systems.
- External components may add
complexity.
- Limited processing power for complex
computations.
- Not suitable for high-end computing
applications.
- May lack some advanced features found in
microprocessors.
Applications of Microcontroller (Embedded Systems.)
 Microcontrollers are task specific and are essentially used for making Embedded
Systems.
 The below image shows very few examples for the application of microcontrollers in
our day-to-day used products.
 Actually wherever we need electronic automation, we use microcontroller. The
application area of microcontrollers is so vast, probably we won’t be able to finish up
listing them all.
 Here we will categorize different application areas of microcontrollers:
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
4
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
1. Consumer Electronics Products:
Toys, Cameras, Robots, Washing Machine, Microwave Ovens etc. [any automatic
home appliance]
2. Instrumentation and Process Control:
Oscilloscopes, Multi-meter, Data Acquisition and Control etc.
3. Medical Instruments:
ECG(electrocardiogram) Machine, Accu-Check (Active Blood Glucose Glucometer)
etc.
4. Communication:
Cell Phones, Telephone Sets, Answering Machines etc.
5. Office Equipment:
Copiers, Printers etc.
6. Multimedia Application:
Mp3 Player, PDAs (Personal digital assistant) etc.
7. Automobile:
Speedometer, Auto-breaking system(ABS) etc.
Brief History of Microcontroller
 The history of microcontrollers dates back to the early days of the development of
integrated circuits and microprocessors.
 Microcontrollers are tiny but powerful computers that have become a crucial part of
our technology-driven world.
 The story begins in the early 1970s when Intel introduced the first microprocessor, the
Intel 4004. It was a small chip designed for calculators but laid the foundation for
something much bigger.
 As the 1980s rolled in, microcontrollers became more popular. They started finding
their way into cars, TVs, and even factories, controlling everything from engine systems
to the display on your microwave. Different companies introduced their own versions
of microcontrollers with unique features.
 Here is a brief timeline of significant events in the history of microcontrollers
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
5
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
 Today, microcontrollers continue to evolve rapidly. With advancements in processing
power, energy efficiency, and features, they play a crucial role in our daily lives.
 From smartphones to smart home devices, microcontrollers are the silent heroes behind
the technology we rely on.
Now, let's briefly introduce PIC and ARM microcontrollers:
1. PIC Microcontrollers:
 Overview: PIC (Peripheral Interface Controller) microcontrollers are a family
of microcontrollers developed by Microchip Technology. They are known for
their ease of use, versatility, and cost-effectiveness.
 Architecture: PIC microcontrollers typically use a Harvard architecture with
separate program memory and data memory. They come in various series, such as
PIC10, PIC12, PIC16, and PIC18, each offering different features and capabilities.
 Programming: PIC microcontrollers are often programmed using assembly
language or higher-level languages like C. Microchip provides development tools,
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
6
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
such as MPLAB IDE, mikroC PRO for PIC for programming and debugging
PIC microcontrollers.
2. ARM Microcontrollers:
 Overview: ARM (Acorn RISC Machine) microcontrollers are part of a family
of RISC (Reduced Instruction Set Computing) processors developed by ARM
Holdings. ARM processors are widely used in various applications, including
microcontrollers, due to their energy efficiency and performance.
 Architecture: ARM microcontrollers typically use a Von Neumann architecture,
where program and data are stored in the same memory. ARM Cortex-M series is
popular for microcontroller applications, offering a range of performance levels
from low-power to high-performance.
 Programming: ARM microcontrollers are often programmed using C or C++
with development tools like Keil MDK, IAR Embedded Workbench, or the ARM
GCC toolchain. ARM microcontrollers are known for their versatility and are used
in a wide range of applications, from low-power IoT devices to high-performance
embedded systems.
Both PIC and ARM microcontrollers have their own strengths and are chosen based on factors
such as cost, power consumption, performance, and the specific requirements of the
application. Each has a diverse ecosystem of development tools and community support to
facilitate the design and development process.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
7
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
Comparison of 8051, PIC, And ARM Microcontrollers
Feature 8051 Microcontrollers PIC Microcontrollers ARM Microcontrollers
Architecture Harvard, 8-bit,RSIC Modified Harvard, 8-bit/16-
bit,RSIC
RISC, 32-bit/64-bit
Instruction
Set
Simple 8-bit instruction
set
Diverse set for 8-bit/16-bit RISC-based instruction set
Memory Limited on-chip memory
 Program Memory
(Flash): 4 KB
 Data Memory
(RAM): 128 bytes
Varied configurations (RAM,
Flash, EEPROM) PIC16F877
 Program Memory
(Flash): 14 KB
 Data Memory (RAM):
368 bytes
 EEPROM: 256 bytes
Larger on-chip memory (Flash,
RAM) LPC2148
 Program Memory (Flash):
512 KB
 Data Memory (RAM): 32
KB
Peripheral
Integration
Basic set of peripherals
 UART
 Timers/Counters
Rich set of integrated
peripherals
 Analog-to-Digital
Converter (ADC)
 Parallel Slave Port
(PSP) for parallel
communication
 Capture/Compare/PWM
(CCP) modules
Versatile, wide range of
peripherals
 CAN (Controller Area
Network)
 USB (Universal Serial
Bus)
 JTAG (Joint Test Action
Group) - for debugging
Power
Consumption
Generally low power
consumption
Designed for power
efficiency
Varied power options
Applications Simple embedded
systems, home appliances
Consumer electronics,
automotive, industrial control
IoT devices, high-performance
computing
Manufacturer Various manufacturers
 Intel
 Atmel (now a part
of Microchip
Technology)
 NXP
Semiconductors
 Silicon Labs
Microchip Technology Various manufacturers (ARM
Holdings licenses the
architecture)
 STMicroelectronics
 Texas Instruments
 NXP (Philips)
 Atmel
Example ICs AT89C51, AT89S52,
AT89C2051
PIC16F877A, PIC18F4550,
PIC32MX series
ARM Cortex-M series
(e.g., Cortex-M0, Cortex-
M3(LPC2148) Cortex-M4)
Advantages Educationally established Rich peripherals for diversity. Versatile, scalable, high
processing power.
Disadvantages Limited power and
memory.
Older models may lack
power.
Costly, potential over-design
complexity.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
8
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
Different Types of Microcontrollers/Classification of Microcontrollers
 Different types of microcontrollers are being used for automatic control of industries,
automobiles, electronic medical devices, appliance & many other embedded systems.
They are mostly preferred due to their compact size, low power consumption & low
cost.
 The microcontrollers are characterized regarding bus-width, instruction set, and
memory structure.
I. On the Basis of Bus-Width
On the basis of bus-width, microcontrollers are categorized by the size of their data bus, which
determines the width of the data path they use for communication within the processor. This
characteristic has a significant impact on the processing capabilities of the microcontroller.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
9
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
1. 8-bit Microcontroller:
 Typically has an 8-bit data bus and ALU (Arithmetic Logic Unit).
 Suitable for simpler applications with limited processing needs.
 Example: 8051, PIC16F877.
2. 16-bit Microcontroller:
 Features a 16-bit data bus, providing improved data handling capabilities.
 Offers better performance for more complex applications.
 Example: Intel 8096, PIC24F16KA102.
3. 32-bit Microcontroller:
 Utilizes a 32-bit data bus, delivering even greater processing power.
 Suitable for applications demanding high computational capabilities.
 Example: NXP LPC 2148(ARM Cortex-M3), STM32F407 (ARM Cortex-M4),
Microchip PIC32 MCUs.
 The bus-width influences how much data the microcontroller can process in a single
clock cycle. While 8-bit microcontrollers are often sufficient for basic tasks, 16-bit and
32-bit microcontrollers offer increased performance, making them suitable for
applications with higher computational requirements.
 The choice of bus-width depends on the specific needs of the embedded system and the
complexity of the tasks it needs to perform.
II. On the Basis of Memory
 Microcontrollers are classified based on their memory architecture, which plays a
crucial role in determining the capabilities and performance of the device.
 Memory in microcontrollers is broadly categorized into two types: embedded memory
and external memory.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
10
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
1. Embedded Memory Microcontroller:
 These microcontrollers have on-chip memory, including both program storage
(ROM or Flash) and data storage (RAM).
 Advantages:
 Compact design.
 Faster access to data and instructions.
 Suitable for applications with moderate memory requirements.
 Example: PIC16F877A.
2. External Memory Microcontroller:
 External memory microcontrollers rely on additional memory components
outside the chip for program and data storage.
 Advantages:
 Scalability for applications with higher memory demands.
 Flexibility to expand memory as needed.
 Example: LPC2148 (ARM Cortex-M3).
III. On the Basis of Instruction Set Architecture
 Architecture: The architecture of a microcontroller refers to its fundamental structure
and organization, encompassing the arrangement and interconnection of its major
components (CPU, Memory, Bus System, Instruction Set etc.)
 Instruction: An instruction is a binary code that represents a specific operation for the
microcontroller to execute. Instructions are the fundamental operations or commands
that a processor understands and performs.
 Instruction Set: The Instruction Set is the complete set of instructions that a
microcontroller or processor supports. It encompasses operations like arithmetic, logic,
data movement, control flow, and more. The efficiency and capabilities of a
microcontroller are influenced by the richness and design of its instruction set.
 Instruction Set Architecture (ISA) is a crucial aspect of microcontroller design,
defining the set of instructions that the microcontroller can execute.
 On the basis of ISA, microcontrollers are categorized into two main types: Complex
Instruction Set Computer (CISC) and Reduced Instruction Set Computer (RISC).
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
11
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
1. CISC (Complex Instruction Set Computer):
 CISC processors were evolved in the 1970s before the evolution of RISC
(Reduced Instruction Set Computers) processors. During this period the
computer memory uses to be ‘small’ and ‘very expensive’.
 Utilizes a larger set of complex instructions.
 Well-suited for applications requiring a variety of instructions.
 Example: PIC18F4550.
Architecture of CISC Processor
 CISC processors were helpful in simplifying the code and making it shorter in order
to reduce the memory requirement.
 In a CISC processor, a single instruction has ‘several low-level operations’. This
makes the CISC instructions short but ‘complex’.
 The main objective of a CISC processor is to minimize the program size by reducing
the number of instructions in a program.
 This is done by ’embedding some of the low-level instructions in a single complex
instruction’.
 Later when decoded this instruction generates several microinstructions to execute.
 Microprogram Control Unit:
CISC processors feature a special microprogram control unit that uses a series
of microinstructions stored in the control memory. These microinstructions
generate control signals to coordinate the processor's hardware.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
12
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
 Control Units and Functioning:
The control units access the control signals from the microprogram control unit
to operate the functioning of the processor's hardware.
 Instruction and Data Path:
The instruction and data path fetch the opcode and operands of instructions from
memory.
 Cache and Main Memory:
Cache and main memory store program instructions and operands.
Characteristics of CISC processors
i. Rich Instruction Set:
CISC processors have a rich and diverse instruction set, offering a wide variety of
complex instructions to perform multiple low-level operations within a single
instruction.
ii. Complex Instruction Decoding:
The decoding of instructions in CISC processors can be complex due to the varied
nature of instructions.
iii. Variable-Length Instructions:
Instructions in CISC processors can have variable lengths, accommodating different
levels of complexity within a single instruction.
iv. Complex Data Types and Addressing Modes:
CISC processors support a wide range of data types and involve complex addressing
modes for versatile programming.
v. Memory Operations:
CISC processors often support operations directly in memory, allowing complex
operations to be performed in a single instruction.
vi. Few General Purpose Registers:
Operations are performed directly in memory, and the results are stored in memory. As
a result, CISC processors typically require fewer general-purpose registers.
vii. More Clock Cycle:
As the size of instructions here is variable thus more than one clock cycle may be used
for instruction execution.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
13
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
2. RISC (Reduced Instruction Set Computers):
 Employs a smaller set of simple instructions.
 Provides efficient and faster execution of instructions.
 Example: PIC16F877, ARM NXP LPC 2148.
Architecture of RISC Processor
 RISC processor has ‘instruction sets’ that are simple and have simple ‘addressing modes’. A
RISC style instruction engages “one word” in memory. Execution of the RISC instructions
are faster and take one clock cycle per instruction.
 RISC processor is implemented using the hardwired control unit. The hardwired control unit
produces control signals which regulate the working of processors hardware. RISC
architecture emphasizes on using the registers rather than memory.
 This is because the registers are the ‘fastest’ available memory source. The registers are
physically small and are placed on the same chip where the ALU and the control unit are
placed on the processor. The RISC instructions operate on the operands present
in processor’s registers.
 Observe one thing here, we don’t have the “microprogram control store” or the “control
memory” like we have seen in the CISC architecture in our previous content.
 It is just because all instructions in RISC are simple and execute one instruction per cycle.
So, here the instructions are hardwired and there is no need for control store.
 For each operation, we will have as defined hardwire. Making an instruction hardwired is
making a function or operation in instruction permanent using connected circuits.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
14
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
Characteristics of RISC Processor
i. Simplicity:
RISC processors have a simplified and streamlined instruction set, focusing on a small set of
simple instructions.
ii. Fixed Instruction Size:
Instructions in RISC processors are generally of fixed length, making them uniform and
predictable.
iii. Single Clock Cycle Execution:
RISC processors aim for single-clock-cycle execution for most instructions, contributing to
higher speed and efficiency.
iv. Large Register Usage:
RISC architectures typically have a large number of general-purpose registers, and instructions
often operate directly on these registers.
v. Load and Store Architecture:
RISC processors follow a Load and Store architecture, where data must be loaded into registers
before any operation and results are stored back to memory afterward.
vi. Pipeline Architecture:
RISC processors often employ pipeline architecture, allowing multiple instructions to be
processed simultaneously in different stages of the pipeline.
vii. Hardwired Control Unit:
RISC processors often use a hardwired control unit, where each instruction corresponds to a
fixed set of control signals
viii. Decoding:
Instructions in RISC processors are generally simpler to decode due to their reduced
complexity, contributing to faster execution.
Example
Suppose, we have an operation A= B+C
No. of Lines CISC Approach RISC Approach
1. MOVE A, B LOAD R1, B
2. ADD A, C LOAD R2, C
3. ADD R3, R1, R2
4. STORE R3, A
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
15
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
Pipelining in RISC Processors (Parallel Execution)
 The Process of fetching the next instruction while the current instruction is being
executed is called as “pipelining”.
 Pipelining is supported by the processor to increase the speed of program execution.
 Increases throughput, several operations take place simultaneously, rather than serially
in pipelining.
 In RISC processors, such as the PIC16F877 and ARM LPC2148, a fundamental
pipelining concept operates through a three-stage pipeline: Fetch, Decode, and Execute.
Three stage pipeline
The three stages used in the pipeline are:
i. Fetch: In this stage the processor fetches the instruction from the memory.
ii. Decode: In this stage recognizes the instruction that is to be executed.
iii. Execute: In this stage the processor processes the instruction and writes the result back
to desired register.
If these three stages of execution are overlapped, we will achieve higher speed of execution.
Example: r6=0xa,r3=0x3
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
16
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
Advantages of Pipelining:
1. Faster Instruction Execution:
 As each stage of the pipeline operates concurrently, the overall time taken to
execute an instruction is reduced.
2. Parallel Processing:
 Enables parallel processing of multiple instructions, making better use of
available resources and improving overall system efficiency.
3. Resource Utilization:
 Enhances resource utilization by allowing different functional units to work
concurrently on different instructions.
4. Cost-Effective:
 Allows for the achievement of higher performance without a proportional
increase in hardware complexity or cost.
5. Scalability:
 Pipelining facilitates scalability, as additional pipeline stages or functional units
can be added to accommodate increased processing demands.
Disadvantages of Pipelining:
1. Pipeline Hazards:
 Introduction of hazards, such as data hazards (dependency between
instructions), structural hazards (resource conflicts), and control hazards
(branch instructions), can reduce pipeline efficiency.
2. Increased Complexity:
 Pipelined processors are more complex to design and implement, leading to
increased development time and potential for errors.
3. Memory Access Delays:
 Delays in memory access, such as cache misses or external memory latency,
can introduce pipeline stalls.
4. Difficulty in Branch Handling:
 Handling branch instructions can be challenging, as mispredictions may result
in flushing the pipeline and wasting clock cycles.
5. Overhead of Instruction Scheduling:
 The need for efficient instruction scheduling to avoid hazards and maintain
pipeline efficiency adds overhead to compiler design.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
17
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
6. Increased Power Consumption:
 Pipelined processors may consume more power due to the simultaneous
operation of multiple pipeline stages and functional units.
Comparison of CISC (Complex Instruction Set Computer) And RISC (Reduced
Instruction Set Computer) Architectures
Feature CISC RISC
Instruction Set Large, diverse, and complex instruction
set.
Small, simple, and uniform instruction set.
Instruction Length Variable-length instructions. Fixed-length instructions.
Operand Types Supports various data types and
addressing modes.
Primarily uses simple data types and
limited addressing modes.
Registers Fewer general-purpose registers. More general-purpose registers.
Instruction
Execution
Emphasis on performing complex
operations in a single instruction.
Instructions designed to execute in a
single clock cycle.
Memory Access Supports operations directly on memory. Uses a Load and Store architecture,
operations on registers.
Instruction
Decoding
More complex due to a larger instruction
set.
Simpler due to a smaller, more
straightforward instruction set.
Pipeline
Complexity
Generally more complex pipelines. Simpler pipelines, often with single-cycle
execution.
Performance and
Throughput
May have lower instruction throughput
per clock cycle.
Generally higher instruction throughput
per clock cycle.
Power
Consumption
Can be higher due to complex
instructions and larger pipelines.
Tends to have lower power consumption
due to simplicity.
Historical
Evolution
Evolved in the 1970s and preceded RISC
architectures.
Emerged as a response to the perceived
inefficiencies of CISC architectures.
Examples x86, x86-64 (Intel, AMD), VAX. ARM, MIPS, PowerPC, SPARC.
Advantages - Rich instruction set allows for
expressive programming.
- Well-suited for high-level language
compilation.
- Complex operations in a single
instruction may reduce program size.
- Simplified instruction set enables faster
execution.
- More predictable and consistent
instruction timing.
- Lower power consumption due to
streamlined design.
Disadvantages - Complexity may lead to longer
development cycles.
- Instruction decoding and pipeline
management challenges.
- Higher power consumption due to
complex instructions.
- May require more instructions for certain
operations.
- Potential inefficiency in handling
complex operations.
- Limited expressiveness in high-level
language compilation.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
18
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
IV. On the Basis of Microcontroller Architecture
 The microcontroller architecture is a set of rules that defines the functionality &
implementation of a microcontroller.
 The program memory (ROM) is used for storing & accessing the code or the instruction.
While the data memory (RAM) is used for storing & accessing the data used by these
instructions.
 There are two types of architecture that differentiate from each other on the basis of
using a single or separate memory for these data & instructions.
1. Harvard Architecture Microcontroller:
 The Harvard architecture based microcontroller has physically separate memory
storage for program code (instructions) & the data, known as the program memory &
the data memory respectively.
 Thus, they have separate bus lines & can be accessed both at the same time. Therefore,
the Harvard architecture based microcontroller can complete instruction in one machine
cycle.
 Due to the two physically separate bus lines, the complexity of the microcontroller
design & the development cost increases.
 They are mostly used in modern microcontrollers & digital signal processing units.
2. Von Neumann (or Princeton) Architecture Microcontroller
 Von Neumann or Princeton architecture suggests to use a single memory for both the
program & data storage.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
19
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
 This concept was proposed by a mathematician Von Neumann in 1945 & It is the most
used architecture in all computers, desktop & laptops to date.
 There is only one bus required for accessing data & fetching instructions. Thus, both
operations cannot be done at the same time & they must be scheduled.
 This is why von Neumann architecture based microcontroller takes two machine cycles
to complete an instruction.
 Since it uses a single bus system, its design is simple & production is very low
compared to Harvard architecture.
Comparison of Harvard Architecture Microcontroller and Von-Neumann (or Princeton)
Architecture Microcontroller
Feature Harvard Architecture
Microcontroller
Von Neumann Architecture
Microcontroller
Memory
Organization
Separate memory spaces for program and
data (instruction and data memories are
distinct).
Unified memory space for both
program instructions and data.
Simultaneous
Access
Allows simultaneous access to program
and data memory.
Potential bottleneck in accessing
program and data memory
simultaneously.
Instruction
Fetching
Parallel fetching of instructions and data. Instructions and data fetched
sequentially from a unified memory
space.
Complexity Can be more complex due to separate
memory spaces.
Simpler architecture with a unified
memory space.
Performance Potential for enhanced performance in
certain scenarios.
May experience bottlenecks in
simultaneous memory access.
Implementation Common in high-performance
applications.
Simple design, often found in
general-purpose computing.
Examples PIC Microcontrollers (PIC16, PIC18) AVR Microcontrollers, some ARM
Cortex-M microcontrollers
Advantages - Simultaneous access to program and
data can enhance performance.
- Potential for parallel instruction
fetching.
- Simplicity in design makes it more
cost-effective.
- Suitable for general-purpose
applications.
Disadvantages - Complexity may lead to increased cost
and power consumption.
- May be overkill for simpler
applications.
- Sequential access may limit certain
high-performance applications.
- Instruction fetching can be less
efficient.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
20
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
V. On the Basis of Microcontroller Family
 The microcontrollers can also be classified according to their family. family is usually
a company or a manufacturer in which controller is fabricated.
 Each family have its own architecture and instruction set. some though 8051 is famous
but PIC and ARM are going more popular than 8051.
 Each of these microcontrollers has its own strengths and is suitable for different
applications based on factors like processing power, memory requirements, and specific
features.
 It's important to choose the right microcontroller based on the needs of the project.
Parameters for Selecting the Right Microcontroller
Choosing the right microcontroller for a project involves considering various factors to ensure
that the selected microcontroller meets the specific requirements and constraints of the
application.
Here are key considerations to guide you in choosing a microcontroller:
1. Application Requirements:
 Understand the specific requirements of your project. Consider factors such as
processing power, memory size, input/output needs, and communication
interfaces.
2. Performance:
 Evaluate the performance characteristics needed for your application. Consider
clock speed, instruction set architecture, and the ability to handle real-time tasks
if required.
3. Power Consumption:
 Assess the power consumption requirements, especially if the application is
battery-powered or needs to operate in a low-power mode. Choose a
microcontroller that balances performance with energy efficiency.
4. Memory Requirements:
 Determine the amount of program memory (Flash) and data memory (RAM)
needed for your application. Ensure that the selected microcontroller has
sufficient memory for your code and data storage.
5. Peripheral Integration:
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
21
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
 Identify the required peripherals for your application, such as analog-to-digital
converters (ADC), timers, communication interfaces (UART, SPI, I2C), and
GPIO pins. Ensure that the microcontroller has the necessary peripherals to
interface with sensors, actuators, and other components.
6. Development Tools and Support:
 Check the availability of development tools, such as compilers, debuggers, and
integrated development environments (IDEs). Choose a microcontroller that has
good support from the manufacturer and a community of developers.
7. Cost:
 Consider the overall cost of the microcontroller, including the chip itself and
any additional components required for the application. Evaluate whether the
selected microcontroller offers the best balance of features for the cost.
8. Package:
 Consider the physical size and package of the microcontroller, especially if
space constraints are a concern.
9. Environmental Considerations:
 Assess the environmental conditions in which the microcontroller will operate.
Choose a microcontroller that meets the required temperature range and
environmental specifications.
10. Security Considerations:
 If security is a concern for your application, look for microcontrollers that offer
built-in security features or can easily integrate with external security measures.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
22
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
Microcontroller Memory Types/Classification of Microcontroller Memory
 The classification of microcontroller memory is a fundamental aspect of understanding
the diverse storage elements within these embedded systems.
 Microcontrollers, which serve as the brain of various electronic devices, employ
different types of memory to store program instructions, process data, and manage
peripheral operations.
 The classification is typically based on several key factors, each playing a unique role
in the overall functionality of the microcontroller.
I. Access Type
Access type in microcontroller memory refers to how data is retrieved.
1. Serial/Sequential Access:
 In serial or sequential access memory, data is accessed in a linear order, one item at
a time.
Microcontroller Memory Types Based On
I. Access
Type
1.Serial/Sequent
ial Access
a)FIFO
Eg:Queue Memory
b)LIFO
Eg:Stack Memort
2.Random
/Direct Access
Eg:SRAM,DR
AM
II. Data
Retention
Capability
1.Volatile/Te
mporary
Memory
Eg:RAM,Cac
he
2.Non-
Volatile/Permanent
Memory
Eg:ROM,EPROM,EEPR
OM,HDD,Pendrive,DVD
III.Primary/Int
ernal Memory
Eg:
RAM,ROM,
Register,
Cache
Memory
IV.Seconary/E
xtranal
Memory
Eg:
HDD,Pendriv
e
Magnetic
Tape ,DVD
V.Storage
Type
1.Semiconduct
or Memory
Eg:RAM,ROM
2.Magentic
Memory
Eg:HDD,Magen
etic Tape
3.Optical
Memory
Eg:CD,DVD
VI.
Program,
Data ,
Peripheral
Memory
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
23
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
 It follows a "first in, first out" (FIFO) or "last in, first out" (LIFO) order.
 Example: Queue Memory is an example of a data structure that follows FIFO, and
Stack Memory follows LIFO.
a) Stack/ (LIFO)
 A stack is a data structure that follows the Last In, First Out (LIFO) principle, where
the last element added is the first one to be removed.
Stack Operations:
1. Push: Adding an element to the top of the stack.
2. Pop: Removing the element from the top of the stack.
3. Peek or Top: Viewing the element at the top without removing it.
 Example: Consider a stack of plates where you add a plate to the top (push) and remove
the topmost plate (pop).
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
24
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
b) Queue/(FIFO)
 A queue is a data structure that follows the First In, First Out (FIFO) principle, where
the first element added is the first one to be removed.
Queue Operations:
 Enqueue: Adding an element to the rear or end of the queue.
 Dequeue: Removing the element from the front or beginning of the queue.
 Front or Peek: Viewing the element at the front without removing it.
 Example: Imagine a queue of people waiting in line, where people join the line at the
back (enqueue) and are served or leave from the front (dequeue).
2.Random/Direct Access:
 Data can be accessed in any order without the need for sequential traversal.
 Examples include SRAM and DRAM.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
25
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
a) Static RAM (SRAM):
 Static RAM is a type of volatile memory in microcontrollers that uses flip-flop
circuits(Transistors) to store data.
Four transistor version of the SRAM cell
 It retains information as long as power is supplied, providing faster access speeds
compared to dynamic RAM (DRAM).
 SRAM is commonly used for cache memory in processors due to its speed and
simplicity.
b) Dynamic RAM (DRAM):
 Dynamic RAM is another type of volatile memory in microcontrollers, relying on
capacitors to store data.
 Unlike SRAM, DRAM requires constant refreshing to maintain data integrity, making
it slower but more cost-effective for larger storage capacities.
 It is often utilized as the main memory in microcontrollers and computers.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
26
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
II. Data Retention Capability
Data retention capability in microcontroller memory refers to whether the memory is temporary
or permanent.
1.Volatile/Temporary Memory:
 Memory that loses its contents when power is turned off, commonly used for temporary
data storage during program execution.
 RAM and cache are volatile examples.
2.Non-Volatile/Permanent Memory:
 Memory that retains data even without power, suitable for storing permanent or semi-
permanent data.
 Examples include ROM, EPROM, EEPROM, HDD, Pendrive, and DVD.
III. Primary/Main/Internal Memory
 Primary or main memory is directly accessible by the microcontroller's processor and
is crucial for temporary data storage during program execution.
 Examples: RAM, ROM, registers, and cache memory are considered primary or main
memory.
Cache Memory:
 Cache memory is a small-sized, high-speed type of volatile computer memory that
provides high-speed data access to a processor and stores frequently used computer
programs, applications, and data.
 It acts as a buffer between the main memory (RAM) and the central processing unit
(CPU).
 Cache memory serves to provide quicker data storage and access by storing instances
of programs and data routinely accessed by the CPU. It reduces the average time to
access data from the main memory, enhancing overall system performance.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
27
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
IV. Secondary/External Memory
 Secondary or external memory is additional storage that is not directly accessed by the
processor but is used for long-term data storage.
 Examples:
 HDD (Hard Disk Drive), Pendrive, Magnetic Tape, and DVD are external memory
types.
V. Storage Type
1. Semiconductor Memory:
 Semiconductor memory uses electronic circuits for data storage. It is faster but often
more expensive compared to other storage types.
 Examples: RAM and ROM are semiconductor memory types.
2. Magnetic Memory:
 Magnetic memory uses magnetic fields to store data and is commonly used for larger-
capacity storage devices.
 Examples: HDD (Hard Disk Drive) and Magnetic Tape are magnetic memory types.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
28
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
3. Optical Memory:
 Optical memory uses laser technology to read and write data on optical discs.
 Examples: CD and DVD are optical memory types.
VI. Program, Data, Peripheral Memory
1. Program Memory (Flash Memory):
 Function: Program memory is used to store the firmware or program code that
the microcontroller executes.
 Type: Pen Drives, SSD(Solid State Disk),SD(Secure Digital) Cards
 Flash memory is the most common type of program memory in modern
microcontrollers. It is non-volatile, meaning that it retains its contents even
when power is turned off.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
29
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
2. Data Memory:
 Function: Data memory is used for storing data that is manipulated and
processed by the microcontroller during its operation. It includes both RAM
(Random Access Memory) and ROM (Read-Only Memory).
 Types: RAM (Random Access Memory), ROM (Read-Only Memory):
3. Peripheral Memory:
 Function: Peripheral memory is used to store configuration settings and data
related to the microcontroller's peripherals, such as timers, counters, and
communication modules.
 Types: EPROM, EEPROM are common type of non-volatile peripheral
memory used for storing configuration data that may need to be retained even
when the power is turned off.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
30
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
Microcontroller Features
Microcontroller features encompass essential elements such as clocking for timing precision,
versatile I/O pins for external communication, interrupts for timely event response, timers for
precise timing control, and a variety of peripherals to expand functionality in embedded
systems.
Following are the some of important features of microcontroller
I. Clocking
 Clocking is a fundamental aspect of microcontrollers that involves the generation and
distribution of clock signals.
 These signals provide the timing reference for the execution of instructions and
synchronization of various components within the microcontroller.
1. Oscillator:
 Microcontrollers have an oscillator, either internal or external, that generates
clock pulses.
 Internal oscillators are convenient for basic applications, while external crystals
or resonators offer higher accuracy.
 External crystals provide high accuracy but may consume more power than
internal oscillators.
 Developers must balance the need for accuracy with power efficiency based on
the application requirements.
2. Clock Distribution:
 Common sources include the internal oscillator, external crystals, and
resonators.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
31
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
 Clock signals generated by the oscillator are distributed to different parts of the
microcontroller
 This ensures that all operations within the microcontroller are synchronized and
occur at the correct timing.
Importance:
1. Timing Precision:
 Clocking is crucial for ensuring the precise execution of instructions. The clock
signal determines the speed at which the CPU processes information.
2. Power Consumption:
 Clock speed influences the power consumption of the microcontroller.
Adjusting the clock frequency can help balance performance and power
efficiency.
 Some microcontrollers support dynamic clocking, where the clock frequency
can be adjusted based on the processing load. This helps optimize power usage.
 Developers must balance the need for accuracy with power efficiency based on
the application requirements.
II. I/O Pins
 Input/Output (I/O) pins in microcontrollers serve as the bridge between the
microcontroller and the external world.
 These pins allow the microcontroller to communicate with various devices, sensors,
and actuators by providing a means for both input and output operations.
Pin Modes:
 I/O pins can be configured as input or output through software settings.
 Configurable modes allow developers to adapt the pins to the specific requirements of
their application.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
32
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
Example: PIC16F877
 In 16F PIC Microcontrollers, there are two registers associated with a port, TRIS and
PORT. eg: TRISB, PORTB, TRISC, PORTC
TRIS Register
 TRIS stands for Tri-State, which determines the direction of each GPIO pin.
 Logic 1 at a particular bit of TRIS register makes the corresponding pin INPUT
 Logic 0 at a particular bit of TRIS register makes the corresponding pin OUTPUT.
 An Input pin of PIC Microcontroller have very high input impedance, thus it may said
to be in Hi-Impedance state.
PORT Register
1. Digital I/O:
 Digital I/O pins can be set to either high (logic '1') or low (logic '0') voltage
levels.
 These pins are used for tasks like reading digital signals, controlling LEDs, and
interfacing with digital sensors.
2. Analog I/O:
 Some pins are dedicated to analog-to-digital conversion (ADC), allowing the
microcontroller to read analog signals from sensors.
 Analog output is also achievable through digital-to-analog converters (DAC) in
certain microcontrollers.
3. Specialized Functions:
 I/O pins may have special functions such as UART (Universal Asynchronous
Receiver/Transmitter), SPI (Serial Peripheral Interface), I2C (Inter-Integrated
Circuit), etc.
 Configurable registers enable developers to set these pins to specific
functionalities.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
33
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
III. Interrupts
An interrupt is a signal that demands immediate attention from the processor, either from
hardware or software. When an interrupt occurs, the current instruction is completed, and
control transfers to an Interrupt Service Routine (ISR) or Interrupt Handler.
a) Hardware Interrupt:
 Definition: A hardware interrupt is an alerting signal sent by external devices, such as
disk controllers or peripherals, to the processor.
 Examples:
 Keyboard/Mouse Input: Pressing a key or moving the mouse triggers
interrupts, enabling the processor to read the input.
 RESET Button: Pressing the RESET button signals a hardware interrupt,
initiating a system reset.
b) Software Interrupt:
 Definition: A software interrupt is caused by exceptional conditions or specific
instructions in the instruction set during processor execution.
 Examples:
 Exceptional Condition: Division by zero can cause a software interrupt,
prompting the microcontroller to handle the error.
 Special Instruction: Specific instructions in the code can generate software
interrupts for controlled execution, enabling specific actions or responses.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
34
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
IV. Timers/Counter
 A timer/counter is an important feature in microcontrollers, used for various purposes
such as generating accurate time delays, measuring time intervals, generating PWM
signals, and more.
 Different microcontrollers may have slightly different implementations of
timers/counters, but the basic concepts are similar.
a) Timer
 A timer is a specialized type of clock which is used to measure time intervals.
 A timer that counts from zero upwards for measuring time elapsed is often called a
stopwatch.
 It is a device that counts down from a specified time interval and used to generate a
time delay.
 It maintains the timing of an operation in sync with a system clock or an external clock.
 In a microcontroller, time intervals are often controlled using timers and counters. The
relationship between time intervals, clock frequency, and timer settings can be
expressed using the following equation:
Prescaler× Timer’s Maximum Value - Initial Value
Time =
Clock Frequency
( )
 Time: The desired time interval in seconds.
 Prescaler: The factor by which the system clock is divided before it is fed into the
timer. It allows us to control the resolution of the timer.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
35
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
 Timer's Maximum Value: The maximum count the timer can reach before it
overflows. This depends on the width of the timer (e.g., 8-bit, 16-bit, 32-bit).
 Initial Value: The starting point from which the timer begins counting.
 Clock Frequency: The frequency of the clock source driving the timer.
Example:
 For an 8-bit timer, the maximum value is 28−1=255.
 Let's choose an initial value of 0 for simplicity:
6 6
64× 255- 0 16320
Time = =
8× 8×
( )
10 10

Time 0.00204 seconds
So, in this example, with a prescaler of 64 and an 8-bit timer, an initial value of 0, and an 8
MHz clock, we would need to set the timer to overflow every 0.00204 seconds to achieve a 1-
millisecond time interval.
b) Counter
 A counter is a device that stores and sometimes displays the number of times a
particular event or process occurred, with respect to a clock signal.
 It is used to count the events happening outside the microcontroller.
 For example, an 8-bit timer will count from 0 to 255.
 The basic equation for a counter in a microcontroller is as follows:
×Time
Clock Frequency
Count =
Prescaler
Example:
Let's consider an example with an 8-bit timer/counter in an microcontroller (e.Gpic16f877).
In this example, we'll assume a clock frequency of 1 MHz and a prescaler value of 64.
×1 ms
1MHz
Count =
64
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
36
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
×0.001
1,000,000
Count =
64

Count 15,625
So, in this example, the counter would accumulate approximately 15,625 counts in 1 ms with
a 64 prescaler and a 1 MHz1 MHz clock frequency.
Comparison Between Timers and Counters in a Microcontroller
Feature Timer Counter
Purpose Used for generating time delays,
measuring time intervals, and periodic
events.
Used for counting external events or
pulses.
Counting
Direction
Counts up from 0 to a maximum value Can count up or down depending on
the application.
Modes Can have various modes (e.g., Timer
mode, PWM mode, Capture mode, etc.)
Usually operates in a simple
counting mode
Clock Source Uses an internal or external clock source Often uses an external event as a
trigger
Prescaler Can have a prescaler to adjust counting
speed
May or may not have a prescaler
Configuration
Complexity
Configuration may involve more options Configuration may be simpler for
basic counting
Applications - Generating PWM signals.
- Generating accurate time delays.
- Timing events.
- Periodic tasks.
- Timekeeping.
- External event counting (e.g., pulse
counting).
- Frequency measurement.
- Encoder interfacing.
V. Peripherals
 Peripherals in the context of microcontrollers refer to additional hardware components
or functional units integrated into the microcontroller chip, beyond its core processing
unit and memory.
 These peripherals provide the microcontroller with specific capabilities to interface
with the external world, communicate with other devices, and perform various tasks.
 Peripherals enhance the versatility of microcontrollers, enabling them to interact with
different types of sensors, actuators, communication devices, and more.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
37
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
Following peripherals are commonly found in microcontrollers:
1. GPIO (General-Purpose Input/Output):
These are pins that can be configured as either input or output, allowing the microcontroller
to interface with digital devices. GPIO pins are versatile and widely used for various
purposes.
2. Communication Peripherals:
 UART (Universal Asynchronous Receiver/Transmitter): Enables serial
communication.
 SPI (Serial Peripheral Interface): Facilitates synchronous serial
communication with other devices.
In SPI three key signals or pins used for communication between devices
MOSI: Master Out Slave In - Data is sent from the master to the slave on this line.
MISO: Master In Slave Out - Data is sent from the slave to the master on this line.
SCK: Serial Clock - This clock signal is used to synchronize the data transmission
between the master and slave devices.
3. I2C (Inter-Integrated Circuit): Allows for communication between integrated circuits
with a simple two-wire interface.
 SDA: Serial Data - Bidirectional line used for transmitting data.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
38
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
 SCL: Serial Clock - Unidirectional clock signal generated by the master to
synchronize data transfer.
4. Analog Peripherals:
 ADC (Analog-to-Digital Converter): Converts analog signals from sensors
into digital values.
 DAC (Digital-to-Analog Converter): Converts digital values into analog
signals.
5. PWM (Pulse Width Modulation): Used for controlling the power supplied to devices like
motors, LEDs, or speakers.
ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I
39
Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24
6. Timers and Counters: These peripherals are used for timekeeping, generating precise
delays, and counting events. They are crucial for tasks like PWM (Pulse Width Modulation)
generation.
7. Interrupt Controllers: Manage and prioritize interrupts, allowing the microcontroller to
respond promptly to external events.
Nested Vectored Interrupt Controller (NVIC) ARM Cortex-M
**********

More Related Content

Similar to ELH-1.3 PIC & ARM MICROCONTROLLER UNIT I Microcontroller’s

Introduction to embedded systems using the msp430 6. 1 Enumerate the.pdf
Introduction to embedded systems using the msp430 6. 1 Enumerate the.pdfIntroduction to embedded systems using the msp430 6. 1 Enumerate the.pdf
Introduction to embedded systems using the msp430 6. 1 Enumerate the.pdfaienterpresses
 
Introduction to embedded systems using the msp430 6.1 Enumerate the .pdf
Introduction to embedded systems using the msp430 6.1 Enumerate the .pdfIntroduction to embedded systems using the msp430 6.1 Enumerate the .pdf
Introduction to embedded systems using the msp430 6.1 Enumerate the .pdfaienterpresses
 
Design and implementation of microcontroller in fpga for io t
Design and implementation of microcontroller in fpga for io tDesign and implementation of microcontroller in fpga for io t
Design and implementation of microcontroller in fpga for io tIJARIIT
 
1GG21EChhhshsjsjsjsjsjsjsjsjjsjs415.pptx
1GG21EChhhshsjsjsjsjsjsjsjsjjsjs415.pptx1GG21EChhhshsjsjsjsjsjsjsjsjjsjs415.pptx
1GG21EChhhshsjsjsjsjsjsjsjsjjsjs415.pptxrealme6igamerr
 
Introduction to Embedded Systems I: Chapter 2 (1st portion)
Introduction to Embedded Systems I: Chapter 2 (1st portion)Introduction to Embedded Systems I: Chapter 2 (1st portion)
Introduction to Embedded Systems I: Chapter 2 (1st portion)Moe Moe Myint
 
Microprocessor vs Microcontroller – An Overview
Microprocessor vs Microcontroller – An OverviewMicroprocessor vs Microcontroller – An Overview
Microprocessor vs Microcontroller – An OverviewLogic Fruit Technologies
 
IRJET- Multiple Load Controller for Industry using ARM Cortex
IRJET-  	  Multiple Load Controller for Industry using ARM CortexIRJET-  	  Multiple Load Controller for Industry using ARM Cortex
IRJET- Multiple Load Controller for Industry using ARM CortexIRJET Journal
 
MergeResult_2023_04_02_05_26_56.pptx
MergeResult_2023_04_02_05_26_56.pptxMergeResult_2023_04_02_05_26_56.pptx
MergeResult_2023_04_02_05_26_56.pptxbhaveshagrawal35
 
What is a microcontroller
What is a microcontrollerWhat is a microcontroller
What is a microcontrollerparassini
 
Chapter-2 Internet of Things.pptx
Chapter-2 Internet of Things.pptxChapter-2 Internet of Things.pptx
Chapter-2 Internet of Things.pptx40NehaPagariya
 
Introduction to Embedded Systems and Microcontrollers
Introduction to Embedded Systems and MicrocontrollersIntroduction to Embedded Systems and Microcontrollers
Introduction to Embedded Systems and MicrocontrollersIslam Samir
 
Design development-and-implementation-of-a temperature-sensor-using-zigbee-co...
Design development-and-implementation-of-a temperature-sensor-using-zigbee-co...Design development-and-implementation-of-a temperature-sensor-using-zigbee-co...
Design development-and-implementation-of-a temperature-sensor-using-zigbee-co...Cemal Ardil
 
The evolution of the microprocessors.pdf
The evolution of the microprocessors.pdfThe evolution of the microprocessors.pdf
The evolution of the microprocessors.pdfpgarg210405
 
Advanced Automation System in Industrial Applications Using PIC Microcontrol...
Advanced Automation System in Industrial Applications Using  PIC Microcontrol...Advanced Automation System in Industrial Applications Using  PIC Microcontrol...
Advanced Automation System in Industrial Applications Using PIC Microcontrol...IJMER
 
chapter1-171214041210 (1).pdf
chapter1-171214041210 (1).pdfchapter1-171214041210 (1).pdf
chapter1-171214041210 (1).pdfHardikH1
 

Similar to ELH-1.3 PIC & ARM MICROCONTROLLER UNIT I Microcontroller’s (20)

Introduction to embedded systems using the msp430 6. 1 Enumerate the.pdf
Introduction to embedded systems using the msp430 6. 1 Enumerate the.pdfIntroduction to embedded systems using the msp430 6. 1 Enumerate the.pdf
Introduction to embedded systems using the msp430 6. 1 Enumerate the.pdf
 
Introduction to embedded systems using the msp430 6.1 Enumerate the .pdf
Introduction to embedded systems using the msp430 6.1 Enumerate the .pdfIntroduction to embedded systems using the msp430 6.1 Enumerate the .pdf
Introduction to embedded systems using the msp430 6.1 Enumerate the .pdf
 
Design and implementation of microcontroller in fpga for io t
Design and implementation of microcontroller in fpga for io tDesign and implementation of microcontroller in fpga for io t
Design and implementation of microcontroller in fpga for io t
 
1GG21EChhhshsjsjsjsjsjsjsjsjjsjs415.pptx
1GG21EChhhshsjsjsjsjsjsjsjsjjsjs415.pptx1GG21EChhhshsjsjsjsjsjsjsjsjjsjs415.pptx
1GG21EChhhshsjsjsjsjsjsjsjsjjsjs415.pptx
 
Introduction to Embedded Systems I: Chapter 2 (1st portion)
Introduction to Embedded Systems I: Chapter 2 (1st portion)Introduction to Embedded Systems I: Chapter 2 (1st portion)
Introduction to Embedded Systems I: Chapter 2 (1st portion)
 
Embedded system
Embedded systemEmbedded system
Embedded system
 
Embeddedsystem
EmbeddedsystemEmbeddedsystem
Embeddedsystem
 
Microprocessor vs Microcontroller – An Overview
Microprocessor vs Microcontroller – An OverviewMicroprocessor vs Microcontroller – An Overview
Microprocessor vs Microcontroller – An Overview
 
IRJET- Multiple Load Controller for Industry using ARM Cortex
IRJET-  	  Multiple Load Controller for Industry using ARM CortexIRJET-  	  Multiple Load Controller for Industry using ARM Cortex
IRJET- Multiple Load Controller for Industry using ARM Cortex
 
8051 microcontrollers
8051 microcontrollers8051 microcontrollers
8051 microcontrollers
 
MergeResult_2023_04_02_05_26_56.pptx
MergeResult_2023_04_02_05_26_56.pptxMergeResult_2023_04_02_05_26_56.pptx
MergeResult_2023_04_02_05_26_56.pptx
 
What is a microcontroller
What is a microcontrollerWhat is a microcontroller
What is a microcontroller
 
Chapter-2 Internet of Things.pptx
Chapter-2 Internet of Things.pptxChapter-2 Internet of Things.pptx
Chapter-2 Internet of Things.pptx
 
Introduction to Embedded Systems and Microcontrollers
Introduction to Embedded Systems and MicrocontrollersIntroduction to Embedded Systems and Microcontrollers
Introduction to Embedded Systems and Microcontrollers
 
Design development-and-implementation-of-a temperature-sensor-using-zigbee-co...
Design development-and-implementation-of-a temperature-sensor-using-zigbee-co...Design development-and-implementation-of-a temperature-sensor-using-zigbee-co...
Design development-and-implementation-of-a temperature-sensor-using-zigbee-co...
 
The evolution of the microprocessors.pdf
The evolution of the microprocessors.pdfThe evolution of the microprocessors.pdf
The evolution of the microprocessors.pdf
 
Advanced Automation System in Industrial Applications Using PIC Microcontrol...
Advanced Automation System in Industrial Applications Using  PIC Microcontrol...Advanced Automation System in Industrial Applications Using  PIC Microcontrol...
Advanced Automation System in Industrial Applications Using PIC Microcontrol...
 
[IJET-V2I3P18] Authors: Mr. B. N. Patil , Mr. Sandesh Sonar , Mr. Pavankumar ...
[IJET-V2I3P18] Authors: Mr. B. N. Patil , Mr. Sandesh Sonar , Mr. Pavankumar ...[IJET-V2I3P18] Authors: Mr. B. N. Patil , Mr. Sandesh Sonar , Mr. Pavankumar ...
[IJET-V2I3P18] Authors: Mr. B. N. Patil , Mr. Sandesh Sonar , Mr. Pavankumar ...
 
ritesh (3)
ritesh (3)ritesh (3)
ritesh (3)
 
chapter1-171214041210 (1).pdf
chapter1-171214041210 (1).pdfchapter1-171214041210 (1).pdf
chapter1-171214041210 (1).pdf
 

Recently uploaded

March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...
March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...
March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...gerogepatton
 
LM7_ Embedded Sql and Dynamic SQL in dbms
LM7_ Embedded Sql and Dynamic SQL in dbmsLM7_ Embedded Sql and Dynamic SQL in dbms
LM7_ Embedded Sql and Dynamic SQL in dbmsBalaKrish12
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionSneha Padhiar
 
Madani.store - Planning - Interview Questions
Madani.store - Planning - Interview QuestionsMadani.store - Planning - Interview Questions
Madani.store - Planning - Interview QuestionsKarim Gaber
 
Chapter 9 Mechanical Injection Systems.pdf
Chapter 9 Mechanical Injection Systems.pdfChapter 9 Mechanical Injection Systems.pdf
Chapter 9 Mechanical Injection Systems.pdfFaizanAhmed396943
 
SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSneha Padhiar
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHSneha Padhiar
 
KCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosKCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosVictor Morales
 
Introduction to Machine Learning Part1.pptx
Introduction to Machine Learning Part1.pptxIntroduction to Machine Learning Part1.pptx
Introduction to Machine Learning Part1.pptxPavan Mohan Neelamraju
 
Submerged Combustion, Explosion Flame Combustion, Pulsating Combustion, and E...
Submerged Combustion, Explosion Flame Combustion, Pulsating Combustion, and E...Submerged Combustion, Explosion Flame Combustion, Pulsating Combustion, and E...
Submerged Combustion, Explosion Flame Combustion, Pulsating Combustion, and E...Ayisha586983
 
A brief look at visionOS - How to develop app on Apple's Vision Pro
A brief look at visionOS - How to develop app on Apple's Vision ProA brief look at visionOS - How to develop app on Apple's Vision Pro
A brief look at visionOS - How to develop app on Apple's Vision ProRay Yuan Liu
 
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptx
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptxTriangulation survey (Basic Mine Surveying)_MI10412MI.pptx
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptxRomil Mishra
 
priority interrupt computer organization
priority interrupt computer organizationpriority interrupt computer organization
priority interrupt computer organizationchnrketan
 
Ergodomus - LOD 400 Production Drawings Exampes - Copy.pdf
Ergodomus - LOD 400 Production Drawings Exampes - Copy.pdfErgodomus - LOD 400 Production Drawings Exampes - Copy.pdf
Ergodomus - LOD 400 Production Drawings Exampes - Copy.pdfgestioneergodomus
 
Overview of IS 16700:2023 (by priyansh verma)
Overview of IS 16700:2023 (by priyansh verma)Overview of IS 16700:2023 (by priyansh verma)
Overview of IS 16700:2023 (by priyansh verma)Priyansh
 
Network Enhancements on BitVisor for BitVisor Summit 12
Network Enhancements on BitVisor for BitVisor Summit 12Network Enhancements on BitVisor for BitVisor Summit 12
Network Enhancements on BitVisor for BitVisor Summit 12cjchen22
 
Prach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism CommunityPrach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism Communityprachaibot
 
Livre Implementing_Six_Sigma_and_Lean_A_prac([Ron_Basu]_).pdf
Livre Implementing_Six_Sigma_and_Lean_A_prac([Ron_Basu]_).pdfLivre Implementing_Six_Sigma_and_Lean_A_prac([Ron_Basu]_).pdf
Livre Implementing_Six_Sigma_and_Lean_A_prac([Ron_Basu]_).pdfsaad175691
 
Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...
Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...
Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...IJAEMSJORNAL
 

Recently uploaded (20)

March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...
March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...
March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...
 
LM7_ Embedded Sql and Dynamic SQL in dbms
LM7_ Embedded Sql and Dynamic SQL in dbmsLM7_ Embedded Sql and Dynamic SQL in dbms
LM7_ Embedded Sql and Dynamic SQL in dbms
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based question
 
Madani.store - Planning - Interview Questions
Madani.store - Planning - Interview QuestionsMadani.store - Planning - Interview Questions
Madani.store - Planning - Interview Questions
 
Chapter 9 Mechanical Injection Systems.pdf
Chapter 9 Mechanical Injection Systems.pdfChapter 9 Mechanical Injection Systems.pdf
Chapter 9 Mechanical Injection Systems.pdf
 
SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
 
KCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosKCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitos
 
Introduction to Machine Learning Part1.pptx
Introduction to Machine Learning Part1.pptxIntroduction to Machine Learning Part1.pptx
Introduction to Machine Learning Part1.pptx
 
Neometrix Optical Balloon Theodolite.pptx
Neometrix Optical Balloon Theodolite.pptxNeometrix Optical Balloon Theodolite.pptx
Neometrix Optical Balloon Theodolite.pptx
 
Submerged Combustion, Explosion Flame Combustion, Pulsating Combustion, and E...
Submerged Combustion, Explosion Flame Combustion, Pulsating Combustion, and E...Submerged Combustion, Explosion Flame Combustion, Pulsating Combustion, and E...
Submerged Combustion, Explosion Flame Combustion, Pulsating Combustion, and E...
 
A brief look at visionOS - How to develop app on Apple's Vision Pro
A brief look at visionOS - How to develop app on Apple's Vision ProA brief look at visionOS - How to develop app on Apple's Vision Pro
A brief look at visionOS - How to develop app on Apple's Vision Pro
 
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptx
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptxTriangulation survey (Basic Mine Surveying)_MI10412MI.pptx
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptx
 
priority interrupt computer organization
priority interrupt computer organizationpriority interrupt computer organization
priority interrupt computer organization
 
Ergodomus - LOD 400 Production Drawings Exampes - Copy.pdf
Ergodomus - LOD 400 Production Drawings Exampes - Copy.pdfErgodomus - LOD 400 Production Drawings Exampes - Copy.pdf
Ergodomus - LOD 400 Production Drawings Exampes - Copy.pdf
 
Overview of IS 16700:2023 (by priyansh verma)
Overview of IS 16700:2023 (by priyansh verma)Overview of IS 16700:2023 (by priyansh verma)
Overview of IS 16700:2023 (by priyansh verma)
 
Network Enhancements on BitVisor for BitVisor Summit 12
Network Enhancements on BitVisor for BitVisor Summit 12Network Enhancements on BitVisor for BitVisor Summit 12
Network Enhancements on BitVisor for BitVisor Summit 12
 
Prach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism CommunityPrach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism Community
 
Livre Implementing_Six_Sigma_and_Lean_A_prac([Ron_Basu]_).pdf
Livre Implementing_Six_Sigma_and_Lean_A_prac([Ron_Basu]_).pdfLivre Implementing_Six_Sigma_and_Lean_A_prac([Ron_Basu]_).pdf
Livre Implementing_Six_Sigma_and_Lean_A_prac([Ron_Basu]_).pdf
 
Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...
Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...
Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...
 

ELH-1.3 PIC & ARM MICROCONTROLLER UNIT I Microcontroller’s

  • 1. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 1 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 Microcontroller’s Introduction  A microcontroller is a Dedicated Programmable Low Cost, integrated circuit(IC) that contains a processor core(CPU), memory (RAM, ROM), and programmable input/output peripherals (ADC, Counter etc.) designed to perform particular task.  Microcontroller is a combination of two words micro and controller, Micro means small in size and controller means a device that can control the operation of any system. So we can say that a microcontroller is a microprocessor with integrated peripherals.  It is designed to be embedded into various systems and devices to control their operation.  Microcontrollers are widely used in electronic appliances, automotive systems, industrial automation, robotics, and many other applications where control and automation are required.
  • 2. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 2 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 Difference Between Microprocessor and Microcontroller Feature Microprocessor Microcontroller Functionality Primarily designed for general-purpose computing, handling complex tasks. Specialized for embedded systems, typically for specific applications or tasks. Integration Central Processing Unit (CPU) is the primary focus, with external components added as needed. Integrated CPU, memory, and peripherals on a single chip. Purpose Used in computers, workstations, servers, and high-level computing applications. Designed for embedded systems, consumer electronics, and specific control applications. Cost Tends to be more expensive due to higher processing power and general- purpose nature. Often more cost-effective, tailored to specific applications, and includes necessary components. Power Consumption May consume more power due to higher processing capabilities. Typically designed for low-power consumption, suitable for battery-powered applications. Memory External memory is required for program storage and data handling. Often includes built-in Flash memory for program storage and RAM for data handling. Peripheral Support Limited on-chip peripherals; external components added as needed. Integrates a variety of on-chip peripherals like timers, ADC, GPIO, and communication interfaces. Complexity Generally more complex due to broader functionality. Simpler design, focused on specific tasks, reducing overall complexity. Examples Intel Core series, AMD Ryzen series. PIC Microcontrollers, AVR Microcontrollers, ARM Cortex-M series. Application Examples Personal computers, servers, high-level computing systems. Embedded systems, IoT devices, consumer electronics, control systems. Development Environment Typically uses high-level programming languages. Often programmed in lower-level languages for resource efficiency. Real-Time Operation May not be optimized for real-time operation. Often designed with real-time capabilities for control applications. Clock Speed Generally operates at higher clock speeds. Operates at moderate to lower clock speeds depending on the application.
  • 3. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 3 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 Advantages - High processing power for multitasking and resource-intensive applications. - Versatility for diverse computing tasks. - Integrated design saves space and cost. - Low power consumption for battery- operated devices. - Real-time capabilities for control applications. Disadvantages - Higher cost and power consumption. - Overkill for many embedded systems. - External components may add complexity. - Limited processing power for complex computations. - Not suitable for high-end computing applications. - May lack some advanced features found in microprocessors. Applications of Microcontroller (Embedded Systems.)  Microcontrollers are task specific and are essentially used for making Embedded Systems.  The below image shows very few examples for the application of microcontrollers in our day-to-day used products.  Actually wherever we need electronic automation, we use microcontroller. The application area of microcontrollers is so vast, probably we won’t be able to finish up listing them all.  Here we will categorize different application areas of microcontrollers:
  • 4. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 4 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 1. Consumer Electronics Products: Toys, Cameras, Robots, Washing Machine, Microwave Ovens etc. [any automatic home appliance] 2. Instrumentation and Process Control: Oscilloscopes, Multi-meter, Data Acquisition and Control etc. 3. Medical Instruments: ECG(electrocardiogram) Machine, Accu-Check (Active Blood Glucose Glucometer) etc. 4. Communication: Cell Phones, Telephone Sets, Answering Machines etc. 5. Office Equipment: Copiers, Printers etc. 6. Multimedia Application: Mp3 Player, PDAs (Personal digital assistant) etc. 7. Automobile: Speedometer, Auto-breaking system(ABS) etc. Brief History of Microcontroller  The history of microcontrollers dates back to the early days of the development of integrated circuits and microprocessors.  Microcontrollers are tiny but powerful computers that have become a crucial part of our technology-driven world.  The story begins in the early 1970s when Intel introduced the first microprocessor, the Intel 4004. It was a small chip designed for calculators but laid the foundation for something much bigger.  As the 1980s rolled in, microcontrollers became more popular. They started finding their way into cars, TVs, and even factories, controlling everything from engine systems to the display on your microwave. Different companies introduced their own versions of microcontrollers with unique features.  Here is a brief timeline of significant events in the history of microcontrollers
  • 5. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 5 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24  Today, microcontrollers continue to evolve rapidly. With advancements in processing power, energy efficiency, and features, they play a crucial role in our daily lives.  From smartphones to smart home devices, microcontrollers are the silent heroes behind the technology we rely on. Now, let's briefly introduce PIC and ARM microcontrollers: 1. PIC Microcontrollers:  Overview: PIC (Peripheral Interface Controller) microcontrollers are a family of microcontrollers developed by Microchip Technology. They are known for their ease of use, versatility, and cost-effectiveness.  Architecture: PIC microcontrollers typically use a Harvard architecture with separate program memory and data memory. They come in various series, such as PIC10, PIC12, PIC16, and PIC18, each offering different features and capabilities.  Programming: PIC microcontrollers are often programmed using assembly language or higher-level languages like C. Microchip provides development tools,
  • 6. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 6 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 such as MPLAB IDE, mikroC PRO for PIC for programming and debugging PIC microcontrollers. 2. ARM Microcontrollers:  Overview: ARM (Acorn RISC Machine) microcontrollers are part of a family of RISC (Reduced Instruction Set Computing) processors developed by ARM Holdings. ARM processors are widely used in various applications, including microcontrollers, due to their energy efficiency and performance.  Architecture: ARM microcontrollers typically use a Von Neumann architecture, where program and data are stored in the same memory. ARM Cortex-M series is popular for microcontroller applications, offering a range of performance levels from low-power to high-performance.  Programming: ARM microcontrollers are often programmed using C or C++ with development tools like Keil MDK, IAR Embedded Workbench, or the ARM GCC toolchain. ARM microcontrollers are known for their versatility and are used in a wide range of applications, from low-power IoT devices to high-performance embedded systems. Both PIC and ARM microcontrollers have their own strengths and are chosen based on factors such as cost, power consumption, performance, and the specific requirements of the application. Each has a diverse ecosystem of development tools and community support to facilitate the design and development process.
  • 7. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 7 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 Comparison of 8051, PIC, And ARM Microcontrollers Feature 8051 Microcontrollers PIC Microcontrollers ARM Microcontrollers Architecture Harvard, 8-bit,RSIC Modified Harvard, 8-bit/16- bit,RSIC RISC, 32-bit/64-bit Instruction Set Simple 8-bit instruction set Diverse set for 8-bit/16-bit RISC-based instruction set Memory Limited on-chip memory  Program Memory (Flash): 4 KB  Data Memory (RAM): 128 bytes Varied configurations (RAM, Flash, EEPROM) PIC16F877  Program Memory (Flash): 14 KB  Data Memory (RAM): 368 bytes  EEPROM: 256 bytes Larger on-chip memory (Flash, RAM) LPC2148  Program Memory (Flash): 512 KB  Data Memory (RAM): 32 KB Peripheral Integration Basic set of peripherals  UART  Timers/Counters Rich set of integrated peripherals  Analog-to-Digital Converter (ADC)  Parallel Slave Port (PSP) for parallel communication  Capture/Compare/PWM (CCP) modules Versatile, wide range of peripherals  CAN (Controller Area Network)  USB (Universal Serial Bus)  JTAG (Joint Test Action Group) - for debugging Power Consumption Generally low power consumption Designed for power efficiency Varied power options Applications Simple embedded systems, home appliances Consumer electronics, automotive, industrial control IoT devices, high-performance computing Manufacturer Various manufacturers  Intel  Atmel (now a part of Microchip Technology)  NXP Semiconductors  Silicon Labs Microchip Technology Various manufacturers (ARM Holdings licenses the architecture)  STMicroelectronics  Texas Instruments  NXP (Philips)  Atmel Example ICs AT89C51, AT89S52, AT89C2051 PIC16F877A, PIC18F4550, PIC32MX series ARM Cortex-M series (e.g., Cortex-M0, Cortex- M3(LPC2148) Cortex-M4) Advantages Educationally established Rich peripherals for diversity. Versatile, scalable, high processing power. Disadvantages Limited power and memory. Older models may lack power. Costly, potential over-design complexity.
  • 8. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 8 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 Different Types of Microcontrollers/Classification of Microcontrollers  Different types of microcontrollers are being used for automatic control of industries, automobiles, electronic medical devices, appliance & many other embedded systems. They are mostly preferred due to their compact size, low power consumption & low cost.  The microcontrollers are characterized regarding bus-width, instruction set, and memory structure. I. On the Basis of Bus-Width On the basis of bus-width, microcontrollers are categorized by the size of their data bus, which determines the width of the data path they use for communication within the processor. This characteristic has a significant impact on the processing capabilities of the microcontroller.
  • 9. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 9 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 1. 8-bit Microcontroller:  Typically has an 8-bit data bus and ALU (Arithmetic Logic Unit).  Suitable for simpler applications with limited processing needs.  Example: 8051, PIC16F877. 2. 16-bit Microcontroller:  Features a 16-bit data bus, providing improved data handling capabilities.  Offers better performance for more complex applications.  Example: Intel 8096, PIC24F16KA102. 3. 32-bit Microcontroller:  Utilizes a 32-bit data bus, delivering even greater processing power.  Suitable for applications demanding high computational capabilities.  Example: NXP LPC 2148(ARM Cortex-M3), STM32F407 (ARM Cortex-M4), Microchip PIC32 MCUs.  The bus-width influences how much data the microcontroller can process in a single clock cycle. While 8-bit microcontrollers are often sufficient for basic tasks, 16-bit and 32-bit microcontrollers offer increased performance, making them suitable for applications with higher computational requirements.  The choice of bus-width depends on the specific needs of the embedded system and the complexity of the tasks it needs to perform. II. On the Basis of Memory  Microcontrollers are classified based on their memory architecture, which plays a crucial role in determining the capabilities and performance of the device.  Memory in microcontrollers is broadly categorized into two types: embedded memory and external memory.
  • 10. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 10 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 1. Embedded Memory Microcontroller:  These microcontrollers have on-chip memory, including both program storage (ROM or Flash) and data storage (RAM).  Advantages:  Compact design.  Faster access to data and instructions.  Suitable for applications with moderate memory requirements.  Example: PIC16F877A. 2. External Memory Microcontroller:  External memory microcontrollers rely on additional memory components outside the chip for program and data storage.  Advantages:  Scalability for applications with higher memory demands.  Flexibility to expand memory as needed.  Example: LPC2148 (ARM Cortex-M3). III. On the Basis of Instruction Set Architecture  Architecture: The architecture of a microcontroller refers to its fundamental structure and organization, encompassing the arrangement and interconnection of its major components (CPU, Memory, Bus System, Instruction Set etc.)  Instruction: An instruction is a binary code that represents a specific operation for the microcontroller to execute. Instructions are the fundamental operations or commands that a processor understands and performs.  Instruction Set: The Instruction Set is the complete set of instructions that a microcontroller or processor supports. It encompasses operations like arithmetic, logic, data movement, control flow, and more. The efficiency and capabilities of a microcontroller are influenced by the richness and design of its instruction set.  Instruction Set Architecture (ISA) is a crucial aspect of microcontroller design, defining the set of instructions that the microcontroller can execute.  On the basis of ISA, microcontrollers are categorized into two main types: Complex Instruction Set Computer (CISC) and Reduced Instruction Set Computer (RISC).
  • 11. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 11 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 1. CISC (Complex Instruction Set Computer):  CISC processors were evolved in the 1970s before the evolution of RISC (Reduced Instruction Set Computers) processors. During this period the computer memory uses to be ‘small’ and ‘very expensive’.  Utilizes a larger set of complex instructions.  Well-suited for applications requiring a variety of instructions.  Example: PIC18F4550. Architecture of CISC Processor  CISC processors were helpful in simplifying the code and making it shorter in order to reduce the memory requirement.  In a CISC processor, a single instruction has ‘several low-level operations’. This makes the CISC instructions short but ‘complex’.  The main objective of a CISC processor is to minimize the program size by reducing the number of instructions in a program.  This is done by ’embedding some of the low-level instructions in a single complex instruction’.  Later when decoded this instruction generates several microinstructions to execute.  Microprogram Control Unit: CISC processors feature a special microprogram control unit that uses a series of microinstructions stored in the control memory. These microinstructions generate control signals to coordinate the processor's hardware.
  • 12. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 12 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24  Control Units and Functioning: The control units access the control signals from the microprogram control unit to operate the functioning of the processor's hardware.  Instruction and Data Path: The instruction and data path fetch the opcode and operands of instructions from memory.  Cache and Main Memory: Cache and main memory store program instructions and operands. Characteristics of CISC processors i. Rich Instruction Set: CISC processors have a rich and diverse instruction set, offering a wide variety of complex instructions to perform multiple low-level operations within a single instruction. ii. Complex Instruction Decoding: The decoding of instructions in CISC processors can be complex due to the varied nature of instructions. iii. Variable-Length Instructions: Instructions in CISC processors can have variable lengths, accommodating different levels of complexity within a single instruction. iv. Complex Data Types and Addressing Modes: CISC processors support a wide range of data types and involve complex addressing modes for versatile programming. v. Memory Operations: CISC processors often support operations directly in memory, allowing complex operations to be performed in a single instruction. vi. Few General Purpose Registers: Operations are performed directly in memory, and the results are stored in memory. As a result, CISC processors typically require fewer general-purpose registers. vii. More Clock Cycle: As the size of instructions here is variable thus more than one clock cycle may be used for instruction execution.
  • 13. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 13 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 2. RISC (Reduced Instruction Set Computers):  Employs a smaller set of simple instructions.  Provides efficient and faster execution of instructions.  Example: PIC16F877, ARM NXP LPC 2148. Architecture of RISC Processor  RISC processor has ‘instruction sets’ that are simple and have simple ‘addressing modes’. A RISC style instruction engages “one word” in memory. Execution of the RISC instructions are faster and take one clock cycle per instruction.  RISC processor is implemented using the hardwired control unit. The hardwired control unit produces control signals which regulate the working of processors hardware. RISC architecture emphasizes on using the registers rather than memory.  This is because the registers are the ‘fastest’ available memory source. The registers are physically small and are placed on the same chip where the ALU and the control unit are placed on the processor. The RISC instructions operate on the operands present in processor’s registers.  Observe one thing here, we don’t have the “microprogram control store” or the “control memory” like we have seen in the CISC architecture in our previous content.  It is just because all instructions in RISC are simple and execute one instruction per cycle. So, here the instructions are hardwired and there is no need for control store.  For each operation, we will have as defined hardwire. Making an instruction hardwired is making a function or operation in instruction permanent using connected circuits.
  • 14. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 14 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 Characteristics of RISC Processor i. Simplicity: RISC processors have a simplified and streamlined instruction set, focusing on a small set of simple instructions. ii. Fixed Instruction Size: Instructions in RISC processors are generally of fixed length, making them uniform and predictable. iii. Single Clock Cycle Execution: RISC processors aim for single-clock-cycle execution for most instructions, contributing to higher speed and efficiency. iv. Large Register Usage: RISC architectures typically have a large number of general-purpose registers, and instructions often operate directly on these registers. v. Load and Store Architecture: RISC processors follow a Load and Store architecture, where data must be loaded into registers before any operation and results are stored back to memory afterward. vi. Pipeline Architecture: RISC processors often employ pipeline architecture, allowing multiple instructions to be processed simultaneously in different stages of the pipeline. vii. Hardwired Control Unit: RISC processors often use a hardwired control unit, where each instruction corresponds to a fixed set of control signals viii. Decoding: Instructions in RISC processors are generally simpler to decode due to their reduced complexity, contributing to faster execution. Example Suppose, we have an operation A= B+C No. of Lines CISC Approach RISC Approach 1. MOVE A, B LOAD R1, B 2. ADD A, C LOAD R2, C 3. ADD R3, R1, R2 4. STORE R3, A
  • 15. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 15 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 Pipelining in RISC Processors (Parallel Execution)  The Process of fetching the next instruction while the current instruction is being executed is called as “pipelining”.  Pipelining is supported by the processor to increase the speed of program execution.  Increases throughput, several operations take place simultaneously, rather than serially in pipelining.  In RISC processors, such as the PIC16F877 and ARM LPC2148, a fundamental pipelining concept operates through a three-stage pipeline: Fetch, Decode, and Execute. Three stage pipeline The three stages used in the pipeline are: i. Fetch: In this stage the processor fetches the instruction from the memory. ii. Decode: In this stage recognizes the instruction that is to be executed. iii. Execute: In this stage the processor processes the instruction and writes the result back to desired register. If these three stages of execution are overlapped, we will achieve higher speed of execution. Example: r6=0xa,r3=0x3
  • 16. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 16 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 Advantages of Pipelining: 1. Faster Instruction Execution:  As each stage of the pipeline operates concurrently, the overall time taken to execute an instruction is reduced. 2. Parallel Processing:  Enables parallel processing of multiple instructions, making better use of available resources and improving overall system efficiency. 3. Resource Utilization:  Enhances resource utilization by allowing different functional units to work concurrently on different instructions. 4. Cost-Effective:  Allows for the achievement of higher performance without a proportional increase in hardware complexity or cost. 5. Scalability:  Pipelining facilitates scalability, as additional pipeline stages or functional units can be added to accommodate increased processing demands. Disadvantages of Pipelining: 1. Pipeline Hazards:  Introduction of hazards, such as data hazards (dependency between instructions), structural hazards (resource conflicts), and control hazards (branch instructions), can reduce pipeline efficiency. 2. Increased Complexity:  Pipelined processors are more complex to design and implement, leading to increased development time and potential for errors. 3. Memory Access Delays:  Delays in memory access, such as cache misses or external memory latency, can introduce pipeline stalls. 4. Difficulty in Branch Handling:  Handling branch instructions can be challenging, as mispredictions may result in flushing the pipeline and wasting clock cycles. 5. Overhead of Instruction Scheduling:  The need for efficient instruction scheduling to avoid hazards and maintain pipeline efficiency adds overhead to compiler design.
  • 17. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 17 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 6. Increased Power Consumption:  Pipelined processors may consume more power due to the simultaneous operation of multiple pipeline stages and functional units. Comparison of CISC (Complex Instruction Set Computer) And RISC (Reduced Instruction Set Computer) Architectures Feature CISC RISC Instruction Set Large, diverse, and complex instruction set. Small, simple, and uniform instruction set. Instruction Length Variable-length instructions. Fixed-length instructions. Operand Types Supports various data types and addressing modes. Primarily uses simple data types and limited addressing modes. Registers Fewer general-purpose registers. More general-purpose registers. Instruction Execution Emphasis on performing complex operations in a single instruction. Instructions designed to execute in a single clock cycle. Memory Access Supports operations directly on memory. Uses a Load and Store architecture, operations on registers. Instruction Decoding More complex due to a larger instruction set. Simpler due to a smaller, more straightforward instruction set. Pipeline Complexity Generally more complex pipelines. Simpler pipelines, often with single-cycle execution. Performance and Throughput May have lower instruction throughput per clock cycle. Generally higher instruction throughput per clock cycle. Power Consumption Can be higher due to complex instructions and larger pipelines. Tends to have lower power consumption due to simplicity. Historical Evolution Evolved in the 1970s and preceded RISC architectures. Emerged as a response to the perceived inefficiencies of CISC architectures. Examples x86, x86-64 (Intel, AMD), VAX. ARM, MIPS, PowerPC, SPARC. Advantages - Rich instruction set allows for expressive programming. - Well-suited for high-level language compilation. - Complex operations in a single instruction may reduce program size. - Simplified instruction set enables faster execution. - More predictable and consistent instruction timing. - Lower power consumption due to streamlined design. Disadvantages - Complexity may lead to longer development cycles. - Instruction decoding and pipeline management challenges. - Higher power consumption due to complex instructions. - May require more instructions for certain operations. - Potential inefficiency in handling complex operations. - Limited expressiveness in high-level language compilation.
  • 18. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 18 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 IV. On the Basis of Microcontroller Architecture  The microcontroller architecture is a set of rules that defines the functionality & implementation of a microcontroller.  The program memory (ROM) is used for storing & accessing the code or the instruction. While the data memory (RAM) is used for storing & accessing the data used by these instructions.  There are two types of architecture that differentiate from each other on the basis of using a single or separate memory for these data & instructions. 1. Harvard Architecture Microcontroller:  The Harvard architecture based microcontroller has physically separate memory storage for program code (instructions) & the data, known as the program memory & the data memory respectively.  Thus, they have separate bus lines & can be accessed both at the same time. Therefore, the Harvard architecture based microcontroller can complete instruction in one machine cycle.  Due to the two physically separate bus lines, the complexity of the microcontroller design & the development cost increases.  They are mostly used in modern microcontrollers & digital signal processing units. 2. Von Neumann (or Princeton) Architecture Microcontroller  Von Neumann or Princeton architecture suggests to use a single memory for both the program & data storage.
  • 19. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 19 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24  This concept was proposed by a mathematician Von Neumann in 1945 & It is the most used architecture in all computers, desktop & laptops to date.  There is only one bus required for accessing data & fetching instructions. Thus, both operations cannot be done at the same time & they must be scheduled.  This is why von Neumann architecture based microcontroller takes two machine cycles to complete an instruction.  Since it uses a single bus system, its design is simple & production is very low compared to Harvard architecture. Comparison of Harvard Architecture Microcontroller and Von-Neumann (or Princeton) Architecture Microcontroller Feature Harvard Architecture Microcontroller Von Neumann Architecture Microcontroller Memory Organization Separate memory spaces for program and data (instruction and data memories are distinct). Unified memory space for both program instructions and data. Simultaneous Access Allows simultaneous access to program and data memory. Potential bottleneck in accessing program and data memory simultaneously. Instruction Fetching Parallel fetching of instructions and data. Instructions and data fetched sequentially from a unified memory space. Complexity Can be more complex due to separate memory spaces. Simpler architecture with a unified memory space. Performance Potential for enhanced performance in certain scenarios. May experience bottlenecks in simultaneous memory access. Implementation Common in high-performance applications. Simple design, often found in general-purpose computing. Examples PIC Microcontrollers (PIC16, PIC18) AVR Microcontrollers, some ARM Cortex-M microcontrollers Advantages - Simultaneous access to program and data can enhance performance. - Potential for parallel instruction fetching. - Simplicity in design makes it more cost-effective. - Suitable for general-purpose applications. Disadvantages - Complexity may lead to increased cost and power consumption. - May be overkill for simpler applications. - Sequential access may limit certain high-performance applications. - Instruction fetching can be less efficient.
  • 20. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 20 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 V. On the Basis of Microcontroller Family  The microcontrollers can also be classified according to their family. family is usually a company or a manufacturer in which controller is fabricated.  Each family have its own architecture and instruction set. some though 8051 is famous but PIC and ARM are going more popular than 8051.  Each of these microcontrollers has its own strengths and is suitable for different applications based on factors like processing power, memory requirements, and specific features.  It's important to choose the right microcontroller based on the needs of the project. Parameters for Selecting the Right Microcontroller Choosing the right microcontroller for a project involves considering various factors to ensure that the selected microcontroller meets the specific requirements and constraints of the application. Here are key considerations to guide you in choosing a microcontroller: 1. Application Requirements:  Understand the specific requirements of your project. Consider factors such as processing power, memory size, input/output needs, and communication interfaces. 2. Performance:  Evaluate the performance characteristics needed for your application. Consider clock speed, instruction set architecture, and the ability to handle real-time tasks if required. 3. Power Consumption:  Assess the power consumption requirements, especially if the application is battery-powered or needs to operate in a low-power mode. Choose a microcontroller that balances performance with energy efficiency. 4. Memory Requirements:  Determine the amount of program memory (Flash) and data memory (RAM) needed for your application. Ensure that the selected microcontroller has sufficient memory for your code and data storage. 5. Peripheral Integration:
  • 21. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 21 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24  Identify the required peripherals for your application, such as analog-to-digital converters (ADC), timers, communication interfaces (UART, SPI, I2C), and GPIO pins. Ensure that the microcontroller has the necessary peripherals to interface with sensors, actuators, and other components. 6. Development Tools and Support:  Check the availability of development tools, such as compilers, debuggers, and integrated development environments (IDEs). Choose a microcontroller that has good support from the manufacturer and a community of developers. 7. Cost:  Consider the overall cost of the microcontroller, including the chip itself and any additional components required for the application. Evaluate whether the selected microcontroller offers the best balance of features for the cost. 8. Package:  Consider the physical size and package of the microcontroller, especially if space constraints are a concern. 9. Environmental Considerations:  Assess the environmental conditions in which the microcontroller will operate. Choose a microcontroller that meets the required temperature range and environmental specifications. 10. Security Considerations:  If security is a concern for your application, look for microcontrollers that offer built-in security features or can easily integrate with external security measures.
  • 22. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 22 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 Microcontroller Memory Types/Classification of Microcontroller Memory  The classification of microcontroller memory is a fundamental aspect of understanding the diverse storage elements within these embedded systems.  Microcontrollers, which serve as the brain of various electronic devices, employ different types of memory to store program instructions, process data, and manage peripheral operations.  The classification is typically based on several key factors, each playing a unique role in the overall functionality of the microcontroller. I. Access Type Access type in microcontroller memory refers to how data is retrieved. 1. Serial/Sequential Access:  In serial or sequential access memory, data is accessed in a linear order, one item at a time. Microcontroller Memory Types Based On I. Access Type 1.Serial/Sequent ial Access a)FIFO Eg:Queue Memory b)LIFO Eg:Stack Memort 2.Random /Direct Access Eg:SRAM,DR AM II. Data Retention Capability 1.Volatile/Te mporary Memory Eg:RAM,Cac he 2.Non- Volatile/Permanent Memory Eg:ROM,EPROM,EEPR OM,HDD,Pendrive,DVD III.Primary/Int ernal Memory Eg: RAM,ROM, Register, Cache Memory IV.Seconary/E xtranal Memory Eg: HDD,Pendriv e Magnetic Tape ,DVD V.Storage Type 1.Semiconduct or Memory Eg:RAM,ROM 2.Magentic Memory Eg:HDD,Magen etic Tape 3.Optical Memory Eg:CD,DVD VI. Program, Data , Peripheral Memory
  • 23. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 23 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24  It follows a "first in, first out" (FIFO) or "last in, first out" (LIFO) order.  Example: Queue Memory is an example of a data structure that follows FIFO, and Stack Memory follows LIFO. a) Stack/ (LIFO)  A stack is a data structure that follows the Last In, First Out (LIFO) principle, where the last element added is the first one to be removed. Stack Operations: 1. Push: Adding an element to the top of the stack. 2. Pop: Removing the element from the top of the stack. 3. Peek or Top: Viewing the element at the top without removing it.  Example: Consider a stack of plates where you add a plate to the top (push) and remove the topmost plate (pop).
  • 24. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 24 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 b) Queue/(FIFO)  A queue is a data structure that follows the First In, First Out (FIFO) principle, where the first element added is the first one to be removed. Queue Operations:  Enqueue: Adding an element to the rear or end of the queue.  Dequeue: Removing the element from the front or beginning of the queue.  Front or Peek: Viewing the element at the front without removing it.  Example: Imagine a queue of people waiting in line, where people join the line at the back (enqueue) and are served or leave from the front (dequeue). 2.Random/Direct Access:  Data can be accessed in any order without the need for sequential traversal.  Examples include SRAM and DRAM.
  • 25. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 25 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 a) Static RAM (SRAM):  Static RAM is a type of volatile memory in microcontrollers that uses flip-flop circuits(Transistors) to store data. Four transistor version of the SRAM cell  It retains information as long as power is supplied, providing faster access speeds compared to dynamic RAM (DRAM).  SRAM is commonly used for cache memory in processors due to its speed and simplicity. b) Dynamic RAM (DRAM):  Dynamic RAM is another type of volatile memory in microcontrollers, relying on capacitors to store data.  Unlike SRAM, DRAM requires constant refreshing to maintain data integrity, making it slower but more cost-effective for larger storage capacities.  It is often utilized as the main memory in microcontrollers and computers.
  • 26. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 26 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 II. Data Retention Capability Data retention capability in microcontroller memory refers to whether the memory is temporary or permanent. 1.Volatile/Temporary Memory:  Memory that loses its contents when power is turned off, commonly used for temporary data storage during program execution.  RAM and cache are volatile examples. 2.Non-Volatile/Permanent Memory:  Memory that retains data even without power, suitable for storing permanent or semi- permanent data.  Examples include ROM, EPROM, EEPROM, HDD, Pendrive, and DVD. III. Primary/Main/Internal Memory  Primary or main memory is directly accessible by the microcontroller's processor and is crucial for temporary data storage during program execution.  Examples: RAM, ROM, registers, and cache memory are considered primary or main memory. Cache Memory:  Cache memory is a small-sized, high-speed type of volatile computer memory that provides high-speed data access to a processor and stores frequently used computer programs, applications, and data.  It acts as a buffer between the main memory (RAM) and the central processing unit (CPU).  Cache memory serves to provide quicker data storage and access by storing instances of programs and data routinely accessed by the CPU. It reduces the average time to access data from the main memory, enhancing overall system performance.
  • 27. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 27 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 IV. Secondary/External Memory  Secondary or external memory is additional storage that is not directly accessed by the processor but is used for long-term data storage.  Examples:  HDD (Hard Disk Drive), Pendrive, Magnetic Tape, and DVD are external memory types. V. Storage Type 1. Semiconductor Memory:  Semiconductor memory uses electronic circuits for data storage. It is faster but often more expensive compared to other storage types.  Examples: RAM and ROM are semiconductor memory types. 2. Magnetic Memory:  Magnetic memory uses magnetic fields to store data and is commonly used for larger- capacity storage devices.  Examples: HDD (Hard Disk Drive) and Magnetic Tape are magnetic memory types.
  • 28. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 28 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 3. Optical Memory:  Optical memory uses laser technology to read and write data on optical discs.  Examples: CD and DVD are optical memory types. VI. Program, Data, Peripheral Memory 1. Program Memory (Flash Memory):  Function: Program memory is used to store the firmware or program code that the microcontroller executes.  Type: Pen Drives, SSD(Solid State Disk),SD(Secure Digital) Cards  Flash memory is the most common type of program memory in modern microcontrollers. It is non-volatile, meaning that it retains its contents even when power is turned off.
  • 29. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 29 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 2. Data Memory:  Function: Data memory is used for storing data that is manipulated and processed by the microcontroller during its operation. It includes both RAM (Random Access Memory) and ROM (Read-Only Memory).  Types: RAM (Random Access Memory), ROM (Read-Only Memory): 3. Peripheral Memory:  Function: Peripheral memory is used to store configuration settings and data related to the microcontroller's peripherals, such as timers, counters, and communication modules.  Types: EPROM, EEPROM are common type of non-volatile peripheral memory used for storing configuration data that may need to be retained even when the power is turned off.
  • 30. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 30 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 Microcontroller Features Microcontroller features encompass essential elements such as clocking for timing precision, versatile I/O pins for external communication, interrupts for timely event response, timers for precise timing control, and a variety of peripherals to expand functionality in embedded systems. Following are the some of important features of microcontroller I. Clocking  Clocking is a fundamental aspect of microcontrollers that involves the generation and distribution of clock signals.  These signals provide the timing reference for the execution of instructions and synchronization of various components within the microcontroller. 1. Oscillator:  Microcontrollers have an oscillator, either internal or external, that generates clock pulses.  Internal oscillators are convenient for basic applications, while external crystals or resonators offer higher accuracy.  External crystals provide high accuracy but may consume more power than internal oscillators.  Developers must balance the need for accuracy with power efficiency based on the application requirements. 2. Clock Distribution:  Common sources include the internal oscillator, external crystals, and resonators.
  • 31. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 31 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24  Clock signals generated by the oscillator are distributed to different parts of the microcontroller  This ensures that all operations within the microcontroller are synchronized and occur at the correct timing. Importance: 1. Timing Precision:  Clocking is crucial for ensuring the precise execution of instructions. The clock signal determines the speed at which the CPU processes information. 2. Power Consumption:  Clock speed influences the power consumption of the microcontroller. Adjusting the clock frequency can help balance performance and power efficiency.  Some microcontrollers support dynamic clocking, where the clock frequency can be adjusted based on the processing load. This helps optimize power usage.  Developers must balance the need for accuracy with power efficiency based on the application requirements. II. I/O Pins  Input/Output (I/O) pins in microcontrollers serve as the bridge between the microcontroller and the external world.  These pins allow the microcontroller to communicate with various devices, sensors, and actuators by providing a means for both input and output operations. Pin Modes:  I/O pins can be configured as input or output through software settings.  Configurable modes allow developers to adapt the pins to the specific requirements of their application.
  • 32. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 32 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 Example: PIC16F877  In 16F PIC Microcontrollers, there are two registers associated with a port, TRIS and PORT. eg: TRISB, PORTB, TRISC, PORTC TRIS Register  TRIS stands for Tri-State, which determines the direction of each GPIO pin.  Logic 1 at a particular bit of TRIS register makes the corresponding pin INPUT  Logic 0 at a particular bit of TRIS register makes the corresponding pin OUTPUT.  An Input pin of PIC Microcontroller have very high input impedance, thus it may said to be in Hi-Impedance state. PORT Register 1. Digital I/O:  Digital I/O pins can be set to either high (logic '1') or low (logic '0') voltage levels.  These pins are used for tasks like reading digital signals, controlling LEDs, and interfacing with digital sensors. 2. Analog I/O:  Some pins are dedicated to analog-to-digital conversion (ADC), allowing the microcontroller to read analog signals from sensors.  Analog output is also achievable through digital-to-analog converters (DAC) in certain microcontrollers. 3. Specialized Functions:  I/O pins may have special functions such as UART (Universal Asynchronous Receiver/Transmitter), SPI (Serial Peripheral Interface), I2C (Inter-Integrated Circuit), etc.  Configurable registers enable developers to set these pins to specific functionalities.
  • 33. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 33 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 III. Interrupts An interrupt is a signal that demands immediate attention from the processor, either from hardware or software. When an interrupt occurs, the current instruction is completed, and control transfers to an Interrupt Service Routine (ISR) or Interrupt Handler. a) Hardware Interrupt:  Definition: A hardware interrupt is an alerting signal sent by external devices, such as disk controllers or peripherals, to the processor.  Examples:  Keyboard/Mouse Input: Pressing a key or moving the mouse triggers interrupts, enabling the processor to read the input.  RESET Button: Pressing the RESET button signals a hardware interrupt, initiating a system reset. b) Software Interrupt:  Definition: A software interrupt is caused by exceptional conditions or specific instructions in the instruction set during processor execution.  Examples:  Exceptional Condition: Division by zero can cause a software interrupt, prompting the microcontroller to handle the error.  Special Instruction: Specific instructions in the code can generate software interrupts for controlled execution, enabling specific actions or responses.
  • 34. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 34 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 IV. Timers/Counter  A timer/counter is an important feature in microcontrollers, used for various purposes such as generating accurate time delays, measuring time intervals, generating PWM signals, and more.  Different microcontrollers may have slightly different implementations of timers/counters, but the basic concepts are similar. a) Timer  A timer is a specialized type of clock which is used to measure time intervals.  A timer that counts from zero upwards for measuring time elapsed is often called a stopwatch.  It is a device that counts down from a specified time interval and used to generate a time delay.  It maintains the timing of an operation in sync with a system clock or an external clock.  In a microcontroller, time intervals are often controlled using timers and counters. The relationship between time intervals, clock frequency, and timer settings can be expressed using the following equation: Prescaler× Timer’s Maximum Value - Initial Value Time = Clock Frequency ( )  Time: The desired time interval in seconds.  Prescaler: The factor by which the system clock is divided before it is fed into the timer. It allows us to control the resolution of the timer.
  • 35. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 35 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24  Timer's Maximum Value: The maximum count the timer can reach before it overflows. This depends on the width of the timer (e.g., 8-bit, 16-bit, 32-bit).  Initial Value: The starting point from which the timer begins counting.  Clock Frequency: The frequency of the clock source driving the timer. Example:  For an 8-bit timer, the maximum value is 28−1=255.  Let's choose an initial value of 0 for simplicity: 6 6 64× 255- 0 16320 Time = = 8× 8× ( ) 10 10  Time 0.00204 seconds So, in this example, with a prescaler of 64 and an 8-bit timer, an initial value of 0, and an 8 MHz clock, we would need to set the timer to overflow every 0.00204 seconds to achieve a 1- millisecond time interval. b) Counter  A counter is a device that stores and sometimes displays the number of times a particular event or process occurred, with respect to a clock signal.  It is used to count the events happening outside the microcontroller.  For example, an 8-bit timer will count from 0 to 255.  The basic equation for a counter in a microcontroller is as follows: ×Time Clock Frequency Count = Prescaler Example: Let's consider an example with an 8-bit timer/counter in an microcontroller (e.Gpic16f877). In this example, we'll assume a clock frequency of 1 MHz and a prescaler value of 64. ×1 ms 1MHz Count = 64
  • 36. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 36 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 ×0.001 1,000,000 Count = 64  Count 15,625 So, in this example, the counter would accumulate approximately 15,625 counts in 1 ms with a 64 prescaler and a 1 MHz1 MHz clock frequency. Comparison Between Timers and Counters in a Microcontroller Feature Timer Counter Purpose Used for generating time delays, measuring time intervals, and periodic events. Used for counting external events or pulses. Counting Direction Counts up from 0 to a maximum value Can count up or down depending on the application. Modes Can have various modes (e.g., Timer mode, PWM mode, Capture mode, etc.) Usually operates in a simple counting mode Clock Source Uses an internal or external clock source Often uses an external event as a trigger Prescaler Can have a prescaler to adjust counting speed May or may not have a prescaler Configuration Complexity Configuration may involve more options Configuration may be simpler for basic counting Applications - Generating PWM signals. - Generating accurate time delays. - Timing events. - Periodic tasks. - Timekeeping. - External event counting (e.g., pulse counting). - Frequency measurement. - Encoder interfacing. V. Peripherals  Peripherals in the context of microcontrollers refer to additional hardware components or functional units integrated into the microcontroller chip, beyond its core processing unit and memory.  These peripherals provide the microcontroller with specific capabilities to interface with the external world, communicate with other devices, and perform various tasks.  Peripherals enhance the versatility of microcontrollers, enabling them to interact with different types of sensors, actuators, communication devices, and more.
  • 37. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 37 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 Following peripherals are commonly found in microcontrollers: 1. GPIO (General-Purpose Input/Output): These are pins that can be configured as either input or output, allowing the microcontroller to interface with digital devices. GPIO pins are versatile and widely used for various purposes. 2. Communication Peripherals:  UART (Universal Asynchronous Receiver/Transmitter): Enables serial communication.  SPI (Serial Peripheral Interface): Facilitates synchronous serial communication with other devices. In SPI three key signals or pins used for communication between devices MOSI: Master Out Slave In - Data is sent from the master to the slave on this line. MISO: Master In Slave Out - Data is sent from the slave to the master on this line. SCK: Serial Clock - This clock signal is used to synchronize the data transmission between the master and slave devices. 3. I2C (Inter-Integrated Circuit): Allows for communication between integrated circuits with a simple two-wire interface.  SDA: Serial Data - Bidirectional line used for transmitting data.
  • 38. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 38 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24  SCL: Serial Clock - Unidirectional clock signal generated by the master to synchronize data transfer. 4. Analog Peripherals:  ADC (Analog-to-Digital Converter): Converts analog signals from sensors into digital values.  DAC (Digital-to-Analog Converter): Converts digital values into analog signals. 5. PWM (Pulse Width Modulation): Used for controlling the power supplied to devices like motors, LEDs, or speakers.
  • 39. ELH: 1.3 PIC & ARM MICROCONTROLLER UNIT – I 39 Notes by Mr. Chandrakantha T S, Dept.t of PG Studies & Research in Electronics Kuvempu University, Jnanasahyadri, Shankaraghatta,2023-24 6. Timers and Counters: These peripherals are used for timekeeping, generating precise delays, and counting events. They are crucial for tasks like PWM (Pulse Width Modulation) generation. 7. Interrupt Controllers: Manage and prioritize interrupts, allowing the microcontroller to respond promptly to external events. Nested Vectored Interrupt Controller (NVIC) ARM Cortex-M **********