0% found this document useful (0 votes)
27 views27 pages

Unit1 Notes

SPPU SE IT Processor Architecture notes unit 1

Uploaded by

a
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views27 pages

Unit1 Notes

SPPU SE IT Processor Architecture notes unit 1

Uploaded by

a
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

fundamental concepts that are often covered in processor architecture notes:

1. Von Neumann Architecture:


● Describes the basic architecture of most computers, with a central processing unit (CPU),
memory, and input/output devices.
● Program instructions and data share the same memory.
2. CPU Components:
● Control Unit (CU): Manages the execution of instructions.
● Arithmetic Logic Unit (ALU): Performs mathematical and logical operations.
● Registers: Fast, small storage locations within the CPU for temporary data storage.
3. Instruction Cycle:
● Fetch, Decode, Execute, and Store - the steps involved in executing a machine language
instruction.
4. Instruction Set Architecture (ISA):
● Describes the set of instructions that a CPU can execute.
● Different processors may have different instruction sets.
5. Pipelining:
● Technique to increase instruction throughput by overlapping the execution of multiple
instructions.
6. Caches:
● Small, high-speed memory units that store frequently used instructions and data to reduce
memory access times.
7. Memory Hierarchy:
● Levels of memory with varying speeds and sizes, such as registers, cache, main memory
(RAM), and secondary storage (e.g., hard drives).
8. RISC (Reduced Instruction Set Computing) vs. CISC (Complex Instruction Set
Computing):
● Different philosophies in designing instruction sets.
● RISC processors have a smaller, simpler set of instructions, while CISC processors have
a more extensive set.
9. Parallel Processing:
● Simultaneous execution of multiple instructions or processes to improve performance.
10. Superscalar and VLIW Architectures:
● Advanced processor architectures that execute multiple instructions in parallel.
11. Endianess:
● Describes how data is stored in computer memory.
● Big-endian and little-endian are the two common formats.
12. Interrupts and Exceptions:
● Mechanisms for handling events that require immediate attention, such as errors or
external input.

A microcontroller is a compact integrated circuit that contains a processor core, memory, and
programmable input/output peripherals. It is designed to execute a specific set of tasks and is
commonly used in embedded systems. Microcontrollers are widely employed in various
applications, ranging from simple household appliances to complex industrial systems. Here's an
introduction to the key components and concepts associated with microcontrollers:

1. Core Components:
● Processor (CPU): The central processing unit performs the actual computation and
controls the execution of instructions.
● Memory:
● RAM (Random Access Memory): Provides temporary data storage for the
microcontroller during program execution.
● Flash/ROM (Read-Only Memory): Stores the firmware or program that is
permanently embedded in the microcontroller.
● Peripherals:
● Input/Output (I/O) ports: Connect the microcontroller to external devices.
● Timers/Counters: Assist in measuring time intervals or counting events.
● Serial Communication Interfaces (UART, SPI, I2C): Facilitate communication
with other devices.
● Analog-to-Digital Converters (ADC): Convert analog signals (e.g., sensor
readings) into digital values.
2. Program Development:
● Microcontrollers are programmed using low-level languages like Assembly or
higher-level languages like C. Integrated Development Environments (IDEs) and
compilers are often used for coding and program compilation.
3. Embedded Systems:
● Microcontrollers are the heart of embedded systems, which are dedicated computing
devices designed for specific tasks. Examples include microwave ovens, washing
machines, automotive control systems, and more.
4. Real-time Operation:
● Many microcontrollers are designed for real-time operation, meaning they can respond to
external events within specific time constraints. This makes them suitable for applications
requiring precise timing, such as controlling motors or reading sensors.
5. Power Efficiency:
● Microcontrollers are optimized for low power consumption, making them suitable for
battery-powered devices and other energy-efficient applications.
6. Variety of Architectures:
● Microcontrollers come in various architectures, including 8-bit, 16-bit, and 32-bit. The
choice depends on the complexity of the application and performance requirements.
7. Development Boards:
● To facilitate experimentation and prototyping, development boards with built-in
microcontrollers are available. Popular examples include Arduino and Raspberry Pi.
8. Programming and Debugging:
● Microcontrollers can be programmed and debugged using various methods, including
in-circuit programming (ICP), JTAG (Joint Test Action Group), or through a bootloader.

In summary, microcontrollers are versatile and essential components in modern electronic


systems, providing a cost-effective solution for a wide range of applications that require
embedded computing capabilities. They play a crucial role in the development of smart devices,
automation, and the Internet of Things (IoT).
History of Microcontrollers:

The history of microcontrollers dates back several decades and is closely tied to the development
of integrated circuits and the evolution of computing technology. Here is a brief overview of the
key milestones in the history of microcontrollers:

1. 1960s: Birth of Microcontrollers:


● The concept of a microcontroller emerged in the early 1960s. Engineers started
integrating logic gates and simple processing units onto a single chip, giving rise to early
microcontrollers.
2. 1970s: Introduction of Microprocessors:
● In the early 1970s, the first microprocessor, the Intel 4004, was introduced. While not a
full microcontroller, it laid the foundation by integrating processing capabilities into a
single chip. The 4004 was followed by the Intel 8008 and 8080, which further advanced
microprocessor technology.
3. 1970s-1980s: Early Microcontrollers:
● In the mid-1970s and throughout the 1980s, dedicated microcontrollers started to emerge.
Companies like Intel, Motorola, and others introduced microcontrollers with integrated
memory, I/O peripherals, and processing units. These early microcontrollers found
applications in simple control tasks.
4. 1980s: 8-bit Microcontrollers:
● The 8-bit microcontroller era began, with companies like Microchip, Intel, and Motorola
producing chips with enhanced capabilities and increased memory. These
microcontrollers found widespread use in consumer electronics, automotive systems, and
industrial applications.
5. 1990s: 16-bit and 32-bit Microcontrollers:
● The 1990s witnessed the introduction of more powerful 16-bit and 32-bit
microcontrollers, providing increased processing power and expanded memory. This
enabled microcontrollers to handle more complex tasks and applications.
6. Late 1990s-2000s: Rise of Embedded Systems:
● The late 1990s and early 2000s marked the rise of embedded systems, with
microcontrollers becoming an integral part of various electronic devices. Development
boards and platforms, such as Arduino and Raspberry Pi, gained popularity, making
microcontroller programming more accessible to hobbyists and developers.
7. 2000s-Present: Advancements in Integration and IoT:
● Microcontrollers continued to evolve with advancements in semiconductor technology.
Integration of more features, peripherals, and connectivity options became common. The
Internet of Things (IoT) boom further accelerated the demand for microcontrollers in a
wide range of applications.
8. 2020s: Continued Innovation:
● In recent years, microcontroller technology has continued to advance, with an emphasis
on energy efficiency, security, and connectivity. The integration of artificial intelligence
(AI) capabilities into microcontrollers has also become a focus of development.
Today, microcontrollers play a crucial role in powering countless electronic devices and
embedded systems, contributing to the ongoing growth of smart technologies and the IoT. The
field continues to evolve, with ongoing research and development focused on enhancing
performance, reducing power consumption, and expanding application domains.

Difference between microprocessor and microcontroller:

Microprocessors and microcontrollers are both integral components of digital systems, but they
serve different purposes and have distinct characteristics. Here are the key differences between
microprocessors and microcontrollers:

1. Function:
● Microprocessor: A microprocessor is primarily designed for general-purpose computing.
It is the central processing unit (CPU) of a computer system and executes instructions
fetched from memory. Microprocessors are commonly used in personal computers and
servers.
● Microcontroller: A microcontroller is designed for specific embedded applications. It
integrates a processor core, memory, and input/output peripherals on a single chip,
making it suitable for dedicated control tasks in embedded systems.
2. Integration:
● Microprocessor: Typically, a microprocessor requires external components, such as
memory (RAM and ROM/Flash), input/output interfaces, and other peripherals, to form a
complete computer system.
● Microcontroller: It is a highly integrated device, containing not only the processor core
but also on-chip memory, I/O ports, timers, and other peripherals. Microcontrollers are
designed to be self-contained, simplifying their use in embedded applications.
3. Applications:
● Microprocessor: Found in general-purpose computing devices like personal computers,
laptops, servers, and workstations where versatility and computational power are crucial.
● Microcontroller: Used in embedded systems, such as automotive control units, home
appliances, industrial automation, medical devices, and other applications that require
real-time control and specific functionality.
4. Usage in Systems:
● Microprocessor: Requires external support for memory, peripherals, and other
components. It is part of a larger system that includes separate components for different
functions.
● Microcontroller: A standalone device designed to perform a specific task. It is often the
sole processing unit in an embedded system.
5. Complexity and Cost:
● Microprocessor: Generally more powerful and complex, leading to higher costs. Suited
for applications that demand high processing capabilities.
● Microcontroller: More cost-effective due to integration and is tailored for applications
with specific functionality, often with lower processing requirements.
6. Power Consumption:
● Microprocessor: Tends to consume more power, as it is optimized for high performance
and versatility.
● Microcontroller: Typically designed for lower power consumption, making it suitable
for battery-powered or energy-efficient applications.
7. Development:
● Microprocessor: Development involves connecting external components and
peripherals, requiring a more extensive setup.
● Microcontroller: Development is often more straightforward, as most components are
integrated on-chip. Development boards are widely available for experimentation and
prototyping.

In summary, while both microprocessors and microcontrollers are crucial components in the
digital world, they are designed for different purposes. Microprocessors are versatile and
powerful, serving general-purpose computing needs, while microcontrollers are specialized for
embedded applications, providing a compact and integrated solution for control tasks.

Criteria for selection of microcontroller:

Selecting the right microcontroller for a project is crucial, as it significantly influences the
performance, power consumption, and overall success of the system. Here are some key criteria
to consider when choosing a microcontroller:

1. Application Requirements:
● Functionality: Clearly define the tasks and functions the microcontroller needs to
perform in the target application.
● Processing Power: Assess the computational requirements to choose a microcontroller
with an appropriate processing speed and capabilities.
2. Memory Requirements:
● Program Memory (Flash/ROM): Consider the size of the program code and choose a
microcontroller with sufficient program memory.
● Data Memory (RAM): Evaluate the data storage needs and select a microcontroller with
an adequate amount of RAM.
3. Peripheral Integration:
● I/O Ports: Determine the number and types of input/output pins required for interfacing
with sensors, actuators, and other devices.
● Communication Interfaces: Consider the need for serial communication (UART, SPI,
I2C), USB, Ethernet, or other interfaces.
● Analog-to-Digital Converters (ADC): If the application involves analog signals, choose
a microcontroller with the required number and resolution of ADC channels.
4. Power Consumption:
● Operating Voltage Range: Ensure that the microcontroller operates within the power
supply constraints of the application.
● Power Modes: Evaluate the availability of low-power modes to optimize energy
consumption, especially for battery-powered devices.
5. Cost:
● Component Cost: Consider the overall cost of the microcontroller, including any
additional components required for operation.
● Development Tools: Assess the availability and cost of development tools, compilers,
and debugging equipment.
6. Availability and Longevity:
● Vendor Support: Choose a microcontroller from a reputable manufacturer with good
technical support and documentation.
● Longevity: Ensure that the chosen microcontroller will be available for the duration of
the product life cycle.
7. Development Environment:
● Development Tools: Evaluate the availability and user-friendliness of development tools,
such as Integrated Development Environments (IDEs), compilers, and debuggers.
● Community Support: A strong community and available online resources can be
beneficial for troubleshooting and sharing knowledge.
8. Size and Package:
● Physical Size: Consider the size constraints of the application, especially in compact or
space-sensitive designs.
● Package Type: Choose a package type (e.g., DIP, QFP, BGA) that suits the
manufacturing and assembly requirements.
9. Temperature and Environmental Considerations:
● Operating Temperature Range: Ensure that the microcontroller can operate within the
specified temperature range for the intended environment.
● Environmental Conditions: Consider factors such as humidity, vibration, and other
environmental conditions.
10. Security Features:
● Assess the security features of the microcontroller, especially if the application involves
sensitive data or communication.
11. Scalability and Future Expansion:
● Consider the scalability of the microcontroller family to accommodate future
enhancements or changes in the project requirements.

By carefully evaluating these criteria, you can choose a microcontroller that aligns with the
specific needs and constraints of your project, leading to a successful and reliable embedded
system.

PIC18FXXX:

The PIC18F series is a family of 8-bit microcontrollers developed by Microchip Technology.


These microcontrollers are widely used in various embedded systems and applications due to
their versatility, features, and reliability. The "XXX" in "PIC18FXXX" represents different
model numbers within the PIC18F series, as there are various models with distinct features and
specifications. Below are some common features associated with the PIC18F series, and specific
details may vary based on the exact model:

1. Processor Core:
● 8-bit Harvard architecture.
2. Clock Speed:
● Available with various clock speeds, supporting internal and external clock sources.
3. Program Memory (Flash):
● On-chip Flash memory for storing program code. Different models have varying amounts
of program memory.
4. Data Memory (RAM):
● On-chip RAM for data storage and manipulation.
5. EEPROM:
● Some models include Electrically Erasable Programmable Read-Only Memory
(EEPROM) for non-volatile data storage.
6. I/O Ports:
● Multiple General-Purpose I/O (GPIO) pins for interfacing with external devices and
sensors.
7. Timers:
● Integrated timers with Capture/Compare/PWM (CCP) modules for various timing and
control applications.
8. Communication Interfaces:
● USART (Universal Synchronous/Asynchronous Receiver/Transmitter) modules for serial
communication.
● SPI (Serial Peripheral Interface) and I2C (Inter-Integrated Circuit) modules for
synchronous and asynchronous serial communication.
9. Analog Features:
● Analog-to-Digital Converters (ADC) for converting analog signals into digital values.
● Comparator modules for analog signal comparison.
10. Interrupts:
● Multiple interrupt sources and an interrupt controller for efficient handling of events.
11. Watchdog Timer:
● Watchdog timer for system reliability by resetting the microcontroller in case of a system
lockup.
12. Operating Voltage:
● Supports a range of operating voltages, allowing for flexibility in power supply
requirements.
13. Low Power Modes:
● Various low-power modes to conserve energy, suitable for battery-powered applications.
14. Security Features:
● Some models may include code protection and other security features.
15. Development Tools:
● Support from Microchip's MPLAB development environment, providing tools for code
development, debugging, and simulation.
16. Package Options:
● Available in various package types, such as DIP (Dual In-line Package), QFP (Quad Flat
Package), and others.
17. Temperature Range:
● Designed to operate within specified temperature ranges.
It's crucial to refer to the datasheet and reference manual of the specific PIC18F model you are
working with to get detailed information about its features, pinout, electrical characteristics, and
programming considerations. The exact features and specifications can vary between different
models within the PIC18F series.

PIC18FXXX Features:

The PIC18F series of microcontrollers, manufactured by Microchip Technology, is part of the


PIC (Peripheral Interface Controller) family. These microcontrollers are widely used in various
embedded systems and applications. While the specific features may vary among different
models within the PIC18F series, here are some common features associated with this family:

1. Architecture:
● The PIC18F series uses an 8-bit Harvard architecture.
2. Clock Speed:
● Typically available with various clock speeds, with options for internal and external clock
sources.
3. Flash Memory:
● Program memory (Flash) for storing user code. The size of the Flash memory varies
among different models within the series.
4. RAM:
● On-chip RAM for data storage and manipulation.
5. EEPROM:
● Some models have integrated Electrically Erasable Programmable Read-Only Memory
(EEPROM) for non-volatile data storage.
6. I/O Ports:
● Multiple General-Purpose I/O (GPIO) pins for interfacing with external devices and
sensors.
7. Timers:
● Built-in timers, including timers with Capture/Compare/PWM (CCP) modules for various
timing and control applications.
8. Communication Interfaces:
● USART (Universal Synchronous/Asynchronous Receiver/Transmitter) modules for serial
communication.
● SPI (Serial Peripheral Interface) and I2C (Inter-Integrated Circuit) modules for
synchronous and asynchronous serial communication.
9. Analog Features:
● Analog-to-Digital Converters (ADC) for converting analog signals into digital values.
● Comparator modules for analog signal comparison.
10. Interrupts:
● Multiple interrupt sources and an interrupt controller for efficient handling of events.
11. Watchdog Timer:
● Watchdog timer for system reliability by resetting the microcontroller in case of a system
lockup.
12. Operating Voltage:
● Supports a range of operating voltages, often allowing for low-power operation.
13. Low Power Modes:
● Various low-power modes to conserve energy in battery-powered applications.
14. Security Features:
● Some models may include security features for code protection and prevention of
unauthorized access.
15. Development Tools:
● Support from Microchip's MPLAB development environment, providing tools for code
development, debugging, and simulation.
16. Package Options:
● Available in various package types, such as DIP (Dual In-line Package), QFP (Quad Flat
Package), and others.
17. Temperature Range:
● Designed to operate within specified temperature ranges, making them suitable for a
variety of environments.

It's important to note that specific models within the PIC18F series may have additional features
or variations. Therefore, when selecting a PIC18F microcontroller for a particular application, it's
recommended to refer to the datasheet of the specific model to ensure accurate information about
its features and capabilities.

PIC18FXXX architecture:

PIC stands for Peripheral Interface Controller. PIC microcontroller was developed by microchip
technology in 1993. It was developed for supporting PDP computers to control its peripheral
devices and that’s why it was named Peripheral Interface Controller. PIC microcontrollers are of
low cost, very fast and easy for the programming and execution of program. Their interfacing
with other peripherals is also very easy. PIC Microcontrollers from Microchip Company are
divided into 4 large families. In this PIC MICROCONTROLLER ARCHITECTURE article, I
will explain step by step about PIC MICROCONTROLLER ARCHITECTURE and components
used in pic microocntrollers. I recommend you to check a list of Pic microcontroller
project here.
● First family: PIC10 (10FXXX) called Low End
● Second family: PIC12 (PIC12FXXX) called Mid-Range
● Third family: PIC16 (16FXXX)
● Fourth family: PIC 17/18 (18FXXX)
Each family has a variety of components along with built in special features. It offers a lot of
memory sizes and pin packages and different clock ratings.

ARCHITECTURE:

PIC Microcontroller architecture is based on Harvard architecture and supports RISC


architecture (Reduced Instruction Set Computer). PIC microcontroller architecture consists of
memory organization (ram, rom, stack), CPU, timers, counter, ADC, DAC, serial
communication, CCP module and I/O ports. PIC microcontroller also supports the protocols like
CAN, SPI, UART for interfacing with other peripherals.

PIC MICROCONTROLLER ARCHITECTURE block diagram

1. CPU (Central Processing Unit):


PIC microcontroller’s CPU consists of

● Arithmetic logic unit (ALU)


● Memory unit (MU)
● Control unit (CU)
● Accumulator
ALU is used for arithmetic operations and for logical decisions. Memory is used for storing the
instructions after processing. Control unit is used to control the internal and external peripherals
which are connected to the CPU and accumulator is used for storing the results.

2. MEMORY ORGANIZATION:
PIC microcontroller memory module consists of mainly 3 types of memories:
● PROGRAM MEMORY:
It contains the written program after we burned it in microcontroller. Program Counter executes
commands stored in the program memory, one after the other. Pic microcontroller can have 8K
words x 14 bits of Flash program memory that can be electrically erased and
reprogrammed. Whenever we burn program into the micro, we erase an old program and write a
new one.

● DATA MEMORY:
It is a RAM type which is used to store the data temporarily in its registers. The RAM memory is
classified into banks. Each bank extends up to 7Fh (128 bytes). Number of banks may vary
depending on the microcontroller. PIC16F84 has only two banks. Banks contain Special
Function Registers (SFR) and General Purpose Registers (GPR). The lower locations of each
bank are reserved for the Special Function Registers and upper locations are for General Purpose
Registers.

General Purpose Registers (GPR):


These registers don’t have any special function. These are used for general purpose for
multiplying, addition or subtraction and then storing the results in other registers. CPU can easily
access the data in these registers.

Special Function Registers (SFR):


These registers are used for special purposes and they cannot be used as normal registers. Their
function is set at the time of manufacturing. They perform the function assigned to them and user
cannot change the function of SFR. Three important SFRs for programming are:

STATUS register: It changes the bank

PORT registers: It assigns logic values 0 or 1 to the ports

TRIS registers: It is a data direction register for input and output

● DATA EEPROM:
This memory allows storing the variables as a result of burning the written program. It is
readable and writable during normal operation (over the full VDD range). This memory is not
directly mapped in the register file. It is indirectly addressed through the SFRs. There are six
SFRs which are used to read and write to this memory (EECON1, EECON2, EEDATA,
EEDATH, EEADR, EEADRH).

3. SERIAL COMMUNICATION:
The transfer of one bit of data at time consecutively over a communication channel is called
Serial Communication. There are three protocols of serial communication:
● USART: It stands for Universal synchronous and Asynchronous Receiver and
Transmitter which provides a serial communication in two devices. In this protocol data
is transmitted and received bit by bit through a single wire according to the clock pulses.
To send and receive data serially the PIC microcontroller has two pins TXD and RXD.
● SPI Protocol: SPI stands for Serial Peripheral Interface. It is used to send data between
PIC microcontrollers and other peripherals like sensors, shift registers and SD cards.
Three wire SPI communications is supported in PIC microcontroller between two devices
on a common clock source. SPI protocol has greater data handling capability than that of
the USART.I2C Protocol: I2C stands for Inter Integrated Circuit, and this protocol is
used to connect low speed devices like microcontrollers, EEPROMS and A/D converters.
PIC microcontroller support two wire Interface or I2C communication between two
devices which can work as both Master and Slave device.

Serial Communication
4. INTERRUPTS:
There are 20 internal interrupts and three external interrupt sources in PIC microcontrollers
which are related with different peripherals like ADC, USART, Timers, and CCP etc.

5. I/O PORTS:
Let us take PIC16 series, it consists of five ports, such as Port A, Port B, Port C, Port D and Port
E.

● Port A:This port is 7-bit wide and can be used for both input and output. The status of
TRISA register decided whether it is used as input or output port.
● Port B:It is an 8-bit port. This port also can be used as input and output. Moreover in
input mode four of its bits are variable according to the interrupt signals.
● Port C:It is also an 8-bit port and can be used as both input and output port which is
determined by the status of the TRISC register.
● Port D:This 8-bit port, unlike Port A, B and C is not an input/output port, but is used as
acts as a slave port for the connection to the microprocessor When in I/O mode Port D
all pins should have Schmitt Trigger buffers.
● Port E:It is a 3-bit port which is used as the additional feature of the control signals to
the A/D converter.
6. CCP MODULE:
A CCP module works in the following three modes:
● Capture Mode: In this mode time is captured when a signal is arrived, or we can say
that, when the CCP pin goes high it captures the value of the Timer1.
● Compare Mode: It works same as an analog comparator, which means that when timer
1’s value reaches some reference value it will give an output signal.
● PWM Mode: This mode provides a 10 bit resolution pulse and duty cycle that is
programmable.
7. Timers:
Timers and counters are important as timers can tell the time and count. PIC microcontroller can
have up to four timers (depending upon the family) Timer0, Timer1, Timer2 and Timer3. Timer0
and Timer2 are of 8-bits while the Timer1 and Timer3 are of 16-bits, which can also be used as
a counter. These timers work according to the selected modes.

8. D/A CONVERTER:
There are no analog outputs in PIC Microcontroller. To get analog output we have to use
external Digital-to-Analog Converter (DAC). It can convert 8 bits of digital number from the
eight digital outputs of PIC microcontroller.

A/DCONVERTER:

It converts the analog voltage levels to digital voltage values. In PIC Microcontroller, ADC has
8-channels and has resolution of 10-bit, which means that if we have to convert an analog
voltage between 0V to 5V the converter will divide it to 2^10 levels (1024 levels). The special
function registers ADCON0 and ADCON1 control the operation of ADC. The converter stores
the lower 8 bits in ADRESL register and the upper bits in the ADRESH register. Reference
voltage of 5V is required for the operation of the converter.
The PIC18F series microcontrollers are based on an 8-bit Harvard architecture, and they are part
of Microchip's PIC (Peripheral Interface Controller) family. Here are key aspects of the
architecture commonly found in PIC18F microcontrollers:
1. CPU Core:
● The CPU core is an 8-bit processor.
● It executes a set of RISC (Reduced Instruction Set Computing) instructions, providing a
streamlined and efficient instruction set.
2. Registers:
● The PIC18F architecture includes a set of general-purpose registers (GPRs) used for
arithmetic and logical operations.
● Special Function Registers (SFRs) control various peripheral functions and system
configurations.
3. Program Memory (Flash):
● The program memory (Flash memory) is used to store the user's program code.
● It is non-volatile, allowing the code to be retained even when power is turned off.
● Program memory is organized into program memory pages, and instructions are fetched
from these pages during program execution.
4. Data Memory (RAM):
● The data memory (RAM) is used for temporary data storage during program execution.
● It is volatile and loses its content when power is turned off.
5. Stack:
● The architecture includes a hardware stack used for storing return addresses and other
temporary data during subroutine calls.
6. I/O Ports:
● General-Purpose I/O (GPIO) pins allow interaction with external devices and sensors.
● Ports are often configurable and can be used for digital input/output or other specific
functions.
7. Timers and Counters:
● Integrated timers and counters, including Capture/Compare/PWM (CCP) modules, for
various timing and control applications.
● Timers are crucial for generating accurate time delays and controlling the timing of
events.
8. Communication Peripherals:
● USART (Universal Synchronous/Asynchronous Receiver/Transmitter) modules for serial
communication.
● SPI (Serial Peripheral Interface) and I2C (Inter-Integrated Circuit) modules for
synchronous and asynchronous serial communication.
9. Analog Features:
● Analog-to-Digital Converters (ADC) for converting analog signals into digital values.
● Comparator modules for comparing analog signals.
10. Interrupt System:
● The architecture supports multiple interrupt sources, and an interrupt controller manages
interrupt prioritization.
11. Watchdog Timer:
● A watchdog timer helps ensure system reliability by resetting the microcontroller if the
program execution gets stuck or encounters an error.
12. Clock Management:
● The microcontroller typically supports various clock sources, allowing flexibility in
choosing the system clock.
● Clock dividers and prescalers help manage the clock frequency.
13. Power Management:
● Low-power modes are available to conserve energy, suitable for battery-powered
applications.
14. Security Features:
● Some models in the PIC18F series include features for code protection and securing the
microcontroller against unauthorized access.

It's important to note that while the overall architecture is common among PIC18F
microcontrollers, specific features and peripherals can vary between different models within the
series. Therefore, it's recommended to refer to the datasheet and reference manual of the specific
PIC18F model you are working with for detailed information on its architecture and features.

Comparison of PIC 18 series microcontrollers:


Comparing PIC18 series microcontrollers involves evaluating different models within the series
based on specific criteria such as features, performance, peripherals, memory, and power
consumption. Here's a general comparison considering common characteristics, but keep in mind
that the specifics may vary among individual PIC18 models. Always refer to the datasheets for
accurate and detailed information.

1. Performance:
● PIC18 microcontrollers vary in terms of clock speed, processing power, and overall
performance. Higher-end models may offer faster clock speeds and more advanced
processing capabilities.
2. Memory:
● Different PIC18 models come with varying amounts of Flash program memory, RAM,
and EEPROM. Choose a model based on the memory requirements of your application.
3. Peripheral Integration:
● PIC18 microcontrollers offer a range of peripherals such as timers, UART, SPI, I2C,
ADC, and PWM modules. Higher-end models may have additional or enhanced
peripherals.
4. Communication Interfaces:
● Consider the communication interfaces required for your application, such as UART, SPI,
and I2C. Ensure that the chosen PIC18 model provides the necessary interfaces.
5. Analog Features:
● Check the availability and specifications of analog features, including the number of
ADC channels, resolution, and other analog peripherals.
6. I/O Ports:
● Evaluate the number of GPIO pins and the flexibility of configuring I/O ports based on
your application's requirements.
7. Clocking Options:
● PIC18 microcontrollers support various clocking options. Consider the available clock
sources, frequency ranges, and clock management features.
8. Power Consumption:
● Assess the power consumption characteristics, especially if the application requires
low-power operation. Some models may have specific low-power modes.
9. Package Options:
● Different PIC18 models come in various package types, such as DIP, QFP, and others.
Choose a package that suits your application's size and assembly requirements.
10. Temperature Range:
● Ensure that the selected PIC18 model operates within the required temperature range for
your application.
11. Security Features:
● Some PIC18 microcontrollers offer security features such as code protection, preventing
unauthorized access to the program memory.
12. Development Tools and Support:
● Consider the availability and quality of development tools, IDEs, compilers, and
community support for the PIC18 model you are evaluating.
13. Cost:
● Factor in the cost of the microcontroller and any additional components required for your
application. Consider the overall system cost.
14. Longevity and Availability:
● Check the long-term availability of the chosen PIC18 model, especially if your product
has a long life cycle.

When comparing PIC18 microcontrollers, it's crucial to identify the specific requirements of
your application and select a model that best meets those requirements. Refer to the datasheets
and reference manuals of individual PIC18 models for detailed and accurate information.

PIC18F458/452 Pin out connection


The PIC18F458 and PIC18F452 are part of the PIC18F family of microcontrollers developed by
Microchip Technology. These two models are quite similar, but there might be some differences
in terms of memory size and peripheral features.

Please note that the pinouts are presented for the 40-pin DIP (Dual In-line Package) versions of
these microcontrollers. If you are using a different package, the pinouts may vary. Always refer
to the specific datasheet of the microcontroller model you are using for the most accurate and
detailed information.

Here is a general pinout for the PIC18F458/452 in a 40-pin DIP package:

luaCopy code
PIC18F458/452 +-----------------+ VSS | 1 40 | VDD RD0 | 2 39 | RA5 RD1 | 3 38 | RA4 RD2 | 4
37 | RA3 RD3 | 5 36 | RA2 RD4 | 6 35 | RA1 RD5 | 7 34 | RA0 RD6 | 8 33 | OSC1 RD7 | 9 32 |
OSC2 VPP | 10 31 | RC7/T1OSI/CCP10 RD8 | 11 30 | RC6/T1OSO/CCP9 RD9 | 12 29 |
RC5/T1CKI/CCP8 RD10 | 13 28 | RC4/T1G/CCP7 RD11 | 14 27 | RC3/CCP6 RD12 | 15 26 |
RC2/CCP5 RD13 | 16 25 | RC1/CCP4 RD14 | 17 24 | RC0/CCP3 RD15 | 18 23 | RB7 | | VSS | 19
22 | RB6 RB0 | 20 21 | RB5 +-----------------+

In this pinout:
● VSS and VDD are ground and power supply, respectively.
● RBx and RCx refer to port pins on Port B and Port C, respectively.
● RDx refers to port pins on Port D.
● OSC1 and OSC2 are the crystal oscillator connections.
● VPP is the programming voltage for In-Circuit Serial Programming (ICSP).
● T1OSI, T1OSO, T1CKI are Timer1-related pins.
● CCPx refers to Capture/Compare/PWM pins, which are associated with the
Capture/Compare/PWM modules.

Please refer to the specific datasheet for your microcontroller model to ensure accuracy and
completeness.

Registers of PIC18F:
The PIC18F microcontrollers have a variety of special function registers (SFRs) that control and
configure the device's peripherals, features, and overall behavior. These registers are
memory-mapped locations that can be read from or written to in order to interact with the
hardware. Below are some commonly used special function registers found in PIC18F
microcontrollers. Keep in mind that this is not an exhaustive list, and the availability of specific
registers can vary between different models within the PIC18F series.

1. General Purpose Registers (GPRs):


● The GPRs are used for general-purpose storage and manipulation of data during program
execution. They are memory locations used by the CPU for temporary storage.
2. Status Register (STATUS):
● The STATUS register contains flags and bits that provide information about the current
state of the CPU and certain conditions in the device.
3. Working Register (WREG):
● The WREG is a general-purpose register used for various arithmetic and logical
operations.
4. Program Counter (PC):
● The PC holds the address of the next instruction to be executed.
5. Stack Pointer (STKPTR):
● The Stack Pointer keeps track of the current position in the call stack during subroutine
calls and interrupts.
6. INDF Register:
● The INDF (Indirect File Register) is often used in indirect addressing modes, allowing
access to data indirectly through an address in another register.
7. File Select Register (FSR):
● The FSR is used for indirect addressing. It points to the memory location being accessed
indirectly.
8. PORTx Registers:
● PORTA, PORTB, PORTC, etc., are used for configuring and reading the status of I/O
ports.
9. TRISx Registers:
● TRISA, TRISB, TRISC, etc., control the direction of the I/O pins (input or output).
10. OPTION_REG:
● The OPTION_REG register is often used to configure various options such as the
prescaler for the Timer0 module.
11. INTCON Register:
● The INTCON register contains flags and control bits related to interrupts and their
sources.
12. Timer Control Registers (T0CON, T1CON, T2CON, etc.):
● Control registers for configuring and controlling timers and counters.
13. CCP Registers (CCPR1L, CCP1CON, CCPR2L, CCP2CON, etc.):
● Registers related to the Capture/Compare/PWM modules.
14. ADCON0 and ADCON1:
● Registers used to configure and control the Analog-to-Digital Converter (ADC) module.
15. TXREG and RCREG:
● Registers for transmitting and receiving data through the USART module.
16. EEDATA, EEADR, EECON1, EECON2:
● Registers used for reading and writing data to the EEPROM memory.
17. LATx Registers:
● LAT registers provide a way to read or write the output latch state of the port pins
independently of the pin's input logic level.

These are just a few examples, and the specific set of registers may vary between PIC18F
models. Always refer to the datasheet and reference manual for the specific PIC18F device you
are using to get accurate information about the available special function registers and their
functionalities.

PIC18 Program and data memory organization:


The PIC18 family of microcontrollers, like other microcontrollers, has a specific organization for
program memory (Flash) and data memory (RAM). Below, I'll provide an overview of the
program and data memory organization for PIC18 devices:

Program Memory (Flash):

1. Memory Architecture:
● The program memory in PIC18 devices is organized into multiple program memory
blocks. Each block typically contains a certain number of words (16-bit instructions).
2. Instruction Set:
● PIC18 microcontrollers use a 16-bit instruction set. Instructions are fetched from program
memory and executed by the CPU.
3. Word Addressability:
● Program memory is word-addressable, meaning each address points to a 16-bit
instruction word. Instructions are fetched in a single operation.
4. Address Range:
● The address range for program memory depends on the specific PIC18 device but is often
16 bits, allowing for a maximum of 64 KB of program memory.
5. Bootloader Area (Optional):
● Some PIC18 devices may have a dedicated bootloader area in program memory, allowing
for firmware updates through In-Circuit Serial Programming (ICSP).
Data Memory (RAM):

1. Memory Organization:
● Data memory (RAM) in PIC18 devices is organized into multiple banks. Each bank has
its set of registers and SFRs (Special Function Registers).
2. Bank Selection:
● The Bank Select Register (BSR) is used to select the active bank. The CPU can access
registers and data in the selected bank.
3. Register Files:
● Each bank contains a set of general-purpose registers (GPRs) and SFRs. The number of
registers and SFRs may vary between banks and PIC18 devices.
4. Address Range:
● The address range for data memory is often 12 bits, allowing for a maximum of 4 KB of
RAM. The actual size of RAM may vary between PIC18 models.
5. Accessing SFRs:
● Special Function Registers (SFRs), controlling various peripherals and features, are
located in specific addresses within data memory. Accessing these registers usually
requires selecting the appropriate bank.
6. Indirect Addressing:
● The PIC18 architecture supports indirect addressing using the FSR (File Select Register),
allowing the CPU to access data indirectly through an address in another register.

Configuration Bits:

1. Configuration Bits Location:


● Configuration bits, which determine the device's operating characteristics, are stored in a
separate area called the Configuration Memory.
2. Protection Bits:
● Some configuration bits may be protected, ensuring that certain settings cannot be
changed during normal program execution.

It's essential to refer to the specific datasheet and reference manual for the PIC18 device you are
working with, as the memory organization details can vary between different models within the
PIC18 family. The information provided here is a general overview.

The Program Counter and Programmable ROM space in the PIC:


In the PIC (Peripheral Interface Controller) architecture, including the PIC18 family, the
Program Counter (PC) and Programmable ROM space (program memory or Flash memory) are
crucial components for program execution. Here's an overview of their roles and functionalities:

Program Counter (PC):

1. Definition:
● The Program Counter (PC) is a register within the CPU that keeps track of the memory
address of the next instruction to be fetched and executed.
2. Word Addressing:
● In the PIC18 architecture, the PC is word-addressable. This means that each address
points to a 16-bit instruction word (a single machine instruction).
3. Incrementing:
● The PC is automatically incremented after each instruction fetch. It points to the next
sequential memory location in program memory.
4. Control Flow:
● During program execution, the PC determines the control flow by pointing to the next
instruction to be executed. Conditional branches or jumps modify the PC to alter the
program flow.
5. Reset Condition:
● After a power-up or a reset condition, the PC is typically initialized to the reset vector
address, which is the starting address of the program.

Programmable ROM Space (Program Memory or Flash):

1. Definition:
● The Programmable ROM space, often referred to as program memory or Flash memory,
is where the machine code or program instructions are stored.
2. Type of Memory:
● In PIC18 microcontrollers, Flash memory is used for program storage. It is non-volatile
memory, meaning that the stored program remains even when the power is turned off.
3. Word Size:
● The Flash memory is word-addressable, where each address points to a 16-bit instruction
word.
4. Writing to Flash:
● During the programming phase, the microcontroller allows writing or programming the
Flash memory with the user's program. After programming, the memory becomes
read-only during normal execution.
5. Block Organization:
● The Flash memory is typically organized into multiple blocks. Each block may have a
specific purpose, such as storing program code, data, or bootloader information.
6. Erasing:
● Flash memory can be erased before reprogramming. This is often done at the block level,
and the erasure is a necessary step before writing new data.
7. Program Memory Limitations:
● There might be limitations on the number of write/erase cycles in Flash memory.
Excessive writes can lead to wear, so care should be taken during development and
testing.
8. Configuration Bits:
● Some portions of the Flash memory may be reserved for configuration bits, which control
various aspects of the microcontroller's behavior.

Initialization:

1. Reset Vector:
● The reset vector is the initial address to which the PC is set during a reset condition. It
points to the starting address of the program in Flash memory.
2. Interrupt Vector Table:
● For devices supporting interrupts, there is often an Interrupt Vector Table in program
memory. Each vector contains the starting address of the interrupt service routine for a
specific interrupt source.

In summary, the Program Counter (PC) is responsible for keeping track of the next instruction to
be executed, and the Programmable ROM space (Flash memory) stores the program instructions.
Together, they ensure the sequential execution of machine code instructions in a PIC18
microcontroller. Always refer to the specific datasheet and reference manual for the PIC18
device you are working with for detailed information on the memory organization and
programming considerations.

File register and Access bank in PIC18:


In PIC18 microcontrollers, the concept of file registers and access banks is associated with the
organization of data memory (RAM). The data memory is organized into multiple banks, and
each bank contains a set of general-purpose registers (GPRs) and special function registers
(SFRs). The term "file registers" is often used to refer to these general-purpose registers.

Data Memory Organization:

1. Bank Selection:
● PIC18 microcontrollers feature multiple banks of data memory (RAM), typically referred
to as Bank 0, Bank 1, etc.
● The Bank Select Register (BSR) is used to select the active bank. The BSR holds the
upper bits of the file register address.
2. Access Bank:
● The Access Bank, also known as Bank 0, is a special bank where the lower 128 bytes of
RAM are directly accessible without using the BSR. This is often the default bank after a
reset or during certain instructions.
3. General-Purpose Registers (GPRs):
● General-purpose registers, often referred to as file registers, are used for temporary
storage and manipulation of data during program execution.
● GPRs are organized into banks, and the specific register accessed depends on both the
bank selected by the BSR and the lower bits of the file register address.

Accessing File Registers:

1. File Register Addressing:


● The file register addressing scheme involves specifying both the bank and the file register
within that bank.
● The BSR register holds the upper bits of the file register address, and the lower bits are
specified directly in the instruction or by the context.
2. Default Bank (Access Bank):
● Some instructions implicitly use the Access Bank (Bank 0) if the BSR is not explicitly
set. This simplifies certain operations as the BSR doesn't need to be modified for
accessing commonly used registers.
3. BSR (Bank Select Register):
● The BSR is a register that allows the CPU to select the bank to be active for register
access. Writing to the BSR changes the active bank.

Special Function Registers (SFRs):

1. SFRs in Different Banks:


● Some SFRs may have multiple instances across different banks. For example, there could
be a Timer0 register in each bank.
● The appropriate bank must be selected using the BSR before accessing SFRs in that bank.

It's important to consult the specific datasheet and reference manual for the PIC18 device you are
working with, as details can vary between different models within the PIC18 family. The
organization of file registers and data memory is a crucial aspect of PIC18 programming, and
understanding it is essential for effective code development.

Bank switching in PIC18:


Bank switching is a concept in PIC18 microcontrollers that involves selecting a specific bank of
data memory (RAM) to work with during program execution. The PIC18 family has multiple
banks of data memory, and the active bank is selected using the Bank Select Register (BSR).
This allows the processor to access different sets of general-purpose registers (GPRs) and special
function registers (SFRs) in different banks.

Here are the key aspects of bank switching in PIC18 microcontrollers:

Banks in PIC18:

1. Bank Organization:
● PIC18 devices typically have multiple banks of data memory, commonly referred to as
Bank 0, Bank 1, etc.
● Each bank has its set of GPRs and SFRs.
2. Access Bank (Bank 0):
● The Access Bank (Bank 0) is a special bank that is directly accessible without explicitly
changing the bank. It is often the default bank after a reset or during certain instructions.
3. BSR (Bank Select Register):
● The BSR is a register dedicated to selecting the active bank.
● It is often an 8-bit register, and its value determines the upper bits of the file register
address.

Bank Switching Procedure:

1. Read/Modify/Write Operations:
● When working with file registers in a specific bank, it's common to follow a
read/modify/write procedure:
● Read: Read the current value of the file register.
● Modify: Perform the necessary operations on the data.
● Write: Write the modified value back to the file register.
2. Selecting the Active Bank:
● Before accessing registers in a specific bank, set the BSR register to the desired bank.
● Use the MOVLW and MOVWF instructions to load the bank number into the WREG
and then write it to the BSR, respectively.
MOVLW 0x01 ; Load bank number 1 into WREG
MOVWF BSR ; Set the active bank to Bank 1

MOVLW 0x01 ; Load bank number 1 into WREG MOVWF BSR ; Set the active bank to Bank 1
3. Default Bank (Access Bank):
● Certain instructions implicitly use the Access Bank (Bank 0) if the BSR is not explicitly
set. This simplifies certain operations.

Understanding and managing bank switching is crucial for effective programming in PIC18
microcontrollers, especially when dealing with a large number of registers and variables. Always
refer to the specific datasheet and reference manual for the PIC18 device you are working with
for detailed information on bank switching and register organization.
Example Code:
Here is a simple example code snippet that demonstrates bank switching:

; Assume Bank 1 is the active bank

MOVLW 0x02 ; Load bank number 2 into WREG

MOVWF BSR ; Set the active bank to Bank 2

; Now, working in Bank 2

MOVLW 0x0A ; Load a value into WREG

MOVWF 0x30 ; Store the value in the file register at address 0x30 in Bank 2

; Switch back to Bank 1

MOVLW 0x01

MOVWF BSR

Addressing modes:
The PIC18 microcontroller architecture supports various addressing modes, which define how
the processor determines the location of operands for instructions. These addressing modes
provide flexibility in accessing data in program memory (Flash), data memory (RAM), and
special function registers (SFRs). Here are some common addressing modes used in PIC18
assembly language:

1. Immediate Addressing (LITERAL):


● In immediate addressing, the operand is a constant value specified directly in the
instruction.
e.g.
MOVLW 0x0A ; Load the literal value 0x0A into WREG
2. Register Direct Addressing:
● Register direct addressing involves specifying a register as an operand. E.g.
MOVF 0x20, WREG ; Move the contents of the file register at address 0x20 to WREG
3. Register Indirect Addressing:
● Register indirect addressing involves using the contents of a register as an address.
● e.g.
● MOVF INDF, WREG ; Move the contents of the file register pointed to by INDF to
WREG
4. Indexed Addressing:
● Indexed addressing allows addressing a register using an offset or index. The offset is
often added to the contents of an index register.
● e.g.
● MOVF 0x30 + WREG, WREG ; Move the contents of the file register at address 0x30 +
WREG to WREG
5. Bit Addressing:
● Bit addressing allows the manipulation of individual bits in a register.
e.g.
BCF PORTA, 0 ; Clear bit 0 in the PORTA register
6. Relative Addressing:
● Relative addressing involves specifying an offset relative to the current program counter
(PC) value.
● E.g.
BRA Label ; Branch to the instruction at Label using relative addressing
7. Literal and Control Addressing (FSR Register):
Literal and control addressing involves using the contents of the FSR (File Select
Register) as an address
e.g.
MOVF INDF, WREG ; Move the contents of the file register pointed to by INDF to
WREG

8. .Stack Operations:
Stack operations involve pushing and popping data onto and from the stack. The stack is
often used for subroutine calls and interrupt handling.
e.g.
PUSH WREG ; Push the contents of WREG onto the stack
These addressing modes provide flexibility in programming PIC18 microcontrollers and allow
efficient manipulation of data and control flow. It's important to consult the specific datasheet
and reference manual for the PIC18 device you are working with, as details can vary between
different models within the PIC18 family.

Oscillator configurations of PIC18


The PIC18 microcontrollers offer various oscillator configurations to cater to different
application requirements. The oscillator is a critical component that provides the clock signal for
the microcontroller, governing the timing of its operations. Here are some common oscillator
configurations for PIC18 microcontrollers:

1. Internal Oscillator (INTOSC):


● The microcontroller uses an internal oscillator as its clock source.
● It is a low-power option suitable for applications with modest clock accuracy
requirements.
● The frequency can be set through configuration bits.

; Example configuration bits setting for internal oscillator at 4 MHz


CONFIG FOSC = INTOSC_HS
CONFIG FREQ = 4
2. External Crystal Oscillator (HS or XT):
● An external crystal is connected to the OSC1 and OSC2 pins, providing a stable clock
source.
● High-Speed (HS) and crystal (XT) oscillator modes are commonly used.
; Example configuration bits setting for an external crystal oscillator at 8 MHz
CONFIG FOSC = HS
CONFIG FREQ = 8
; Example configuration bits setting for an external crystal oscillator at 8 MHz CONFIG FOSC =
HS CONFIG FREQ = 8
3. External Resonator Oscillator (XT, LP):
● An external resonator (ceramic resonator) can be connected to the OSC1 and OSC2 pins.
● XT (Crystal or Ceramic Resonator) and LP (Low Power Crystal or Ceramic Resonator)
oscillator modes are available.
; Example configuration bits setting for an external resonator oscillator at 4 MHz
CONFIG FOSC = XT
CONFIG FREQ = 4
; Example configuration bits setting for an external resonator oscillator at 4 MHz CONFIG
FOSC = XT CONFIG FREQ = 4
4. External Clock Source (EC):
● The microcontroller uses an external clock source applied to the OSC1 pin.
● Suitable for cases where an external system provides a clock signal.
; Example configuration bits setting for an external clock source
CONFIG FOSC = EC
; Example configuration bits setting for an external clock source CONFIG FOSC = EC
5. Internal RC Oscillator (IRC):
● The microcontroller uses an internal RC oscillator as its clock source.
● This oscillator is less accurate than a crystal, but it is suitable for low-cost applications.
; Example configuration bits setting for internal RC oscillator at 4 MHz
CONFIG FOSC = IRC
CONFIG FREQ = 4
6. Two-Speed Start-up (TSS):
● Two-Speed Start-up is a feature that allows the oscillator to start quickly for faster system
initialization.
; Example configuration bits setting for two-speed start-up
CONFIG FOSC = HS, IESO = ON
CONFIG FREQ = 8
; Example configuration bits setting for two-speed start-up CONFIG FOSC = HS, IESO = ON
CONFIG FREQ = 8

These examples show how configuration bits are typically set in assembly language to select the
desired oscillator configuration. The specific names of configuration bits may vary slightly
depending on the exact PIC18 device model.

Always refer to the datasheet and reference manual for the specific PIC18 microcontroller you
are using to obtain accurate information on oscillator configurations and the corresponding
configuration bit settings.
Reset operations of PIC18
Reset operations in PIC18 microcontrollers involve actions taken when the microcontroller is
powered on or undergoes a reset condition. Resetting the microcontroller initializes its various
components, clears registers, and prepares it for a fresh start. There are different types of reset
operations in PIC18 microcontrollers:

1. Power-On Reset (POR):


● Power-On Reset occurs when power is initially applied to the microcontroller.
● The microcontroller goes through a POR sequence, initializing the CPU, memory, and
other peripherals.
● Configuration bits are loaded from non-volatile memory.
2. Brown-Out Reset (BOR):
● Brown-Out Reset occurs when the power supply voltage drops below a specified
threshold.
● It prevents erratic behavior due to insufficient voltage.
● The microcontroller resets, and the POR sequence is executed.
3. External Reset (MCLR Pin):
● An external reset can be initiated by applying a low voltage to the MCLR (Master Clear)
pin.
● It is often used for manual reset control or by external circuitry.
; Example configuration bit setting for enabling MCLR as an external reset
CONFIG MCLRE = ON;
4. Watchdog Timer Reset (WDT):
● The Watchdog Timer Reset occurs when the Watchdog Timer is not reset within its
configured timeout period.
● The Watchdog Timer resets the microcontroller to prevent the system from hanging.
; Example configuration bit setting for enabling the Watchdog Timer
CONFIG WDTE = ON; Example configuration bit setting for enabling the Watchdog Timer
CONFIG WDTE = ON
5. Software Reset (Reset Instruction):
● The software reset instruction (RESET) allows the microcontroller to be reset
programmatically.
● It is used to initiate a reset from within the program.
RESET
6. Configuration Bit Settings:
● Configuration bits in the program memory determine the behavior of the microcontroller
during resets.
● Various reset-related configuration bits include Brown-Out Reset (BOR), Master Clear
Enable (MCLRE), Watchdog Timer Enable (WDTE), etc.

Example configuration bits setting for enabling Brown-Out Reset (BOR) and Master Clear
(MCLR)
CONFIG BOR = ON
CONFIG MCLRE = ON

It's essential to configure the appropriate bits in the configuration word to control the behavior of
the microcontroller during reset conditions. The configuration bits vary between different PIC18
devices, so consult the datasheet and reference manual for your specific microcontroller model
for accurate and detailed information on configuring reset-related settings.

You might also like