SlideShare a Scribd company logo
1 of 30
Download to read offline
UNIT-V
PIC16F877 MICROCONTROLLER
11/2/2023 1
11/2/2023 2
UNIT-V (Syllabus)
8 bit microcontroller.
Operating Speed: Up to 20 MHz
Flash program memory (14 bit words), 8KB.
Data memory:Data SRAM: 368 bytes &Data EEPROM:
256 bytes.
Power-saving Sleep mode.
5 input/output ports
It has 15 interrupt signal.
Three timers
35 instructions
10bit A/D module (8 channels)
In-Circuit Serial Programming via two pins (5V)
Watchdog Timer with on-chip RC oscillator.
11/2/2023 3
FEATURES
11/2/2023 4
The main features of PIC microcontrollers are RAM, flash memory, Timers/
Counters, EEPROM, I/O Ports, USART, CCP (Capture/Compare/PWM module),
SSP, Comparator, ADC (analog to digital converter), PSP(parallel slave port),
LCD and ICSP (in circuit serial programming) .
The PIC microcontroller architecture comprises of CPU, I/O ports, memory
organization, A/D converter, timers/counters, interrupts, serial
communication, oscillator and CCP module which are discussed in detailed
below.
11/2/2023 5
Architecture of PIC16F877
MICROCONTROLLER
11/2/2023 6
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.
11/2/2023 7
CPU (Central Processing Unit)
The memory module in the PIC microcontroller architecture
consists of
1. Data Memory (RAM)
2. Data EEPROM
3. Program Memory (FLASH Type)
11/2/2023 8
Memory Organization
RAM is an unstable memory which is used to store the data
temporarily in its registers.
The RAM memory is classified into two banks, and each bank
consists of so many registers.
The RAM registers are classified into two types:
1.Special Function Registers (SFR)
2. General Purpose Registers (GPR).
11/2/2023 9
1.Random Access Memory
(RAM)
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
11/2/2023 10
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
1. EECON1
2.EECON2
3.EEDATA
4.EEDATH
5.EEADR
6.EEADRH
11/2/2023 11
2.DATA EEPROM:
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 microcontroller, we
erase an old program and write a new one.
11/2/2023 12
3. Program Memory (FLASH
Type)
Serial communication is the method of transferring data one
bit at a time sequentially over a communication channel.
There are three protocols of serial communication:
1.USART
2.SPI (Serial Peripheral Interface)
3.I2C (Inter Integrated Circuit)
1.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.
11/2/2023 13
Serial Communication
2.SPI (Serial Peripheral Interface)
❖ 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.
3.I2C (Inter Integrated Circuit)
❖ 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.
11/2/2023 14
Interrupts
❖ There are 15 internal interrupts in PIC microcontrollers
which are related with different peripherals like ADC, USART,
Timers, and CCP etc.
Timers/ Counters
❖ PIC microcontroller has 3 timer/counters (T0,T1,T2) where in
the one 8-bit timer and the remaining timers have the choice
to select 8 or 16-bit mode.
❖ Timers are used for generating specific time delays between
two operations.
A/D Converter:
❖ It converts the analog voltage levels to digital voltage values.
In PIC Microcontroller, ADC has 8-channels and has resolution
of 10-bit.
❖ The special function registers ADCON0 and ADCON1 control
the operation of ADC.
11/2/2023 15
CCP module:
The name CCP module stands for capture/compare/PWM
where it works in three modes such as capture mode,
compare mode and PWM mode.
Capture Mode: Capture mode captures the time of arrival of
a signal.
Compare Mode: Compare mode acts as an analog comparator.
PWM Mode: PWM mode provides pulse width modulated
output with a 10-bit resolution and programmable duty cycle.
Oscillators
Oscillators are used for timing generation.
PIC microcontroller consist of external oscillators like RC
oscillators or crystal oscillators.
The range of clock frequency is upto 20MHz.
11/2/2023 16
Input/Output Ports
The series of PIC16f877 consists of five ports such as Port
A, Port B, Port C, Port D & Port E.
❖ Port A is an 6-bit port that can be used as input or output
port based on the status of the TRISA (Tradoc Intelligence
Support Activity) register.
❖ Port B is an 8- bit port that can be used as both input and
output port.
❖ Port C is an 8-bit port that can be used as input or output
port based on the status of the TRISC register.
❖ Port D is an 8-bit port acts as a slave port for connection to
the microprocessor BUS.
❖ Port E is a 3-bit port which serves the additional function of
the control signals to the analog to digital converter.
11/2/2023 17
Watchdog timer is a timer that resets the microcontroller in
case the program gets stuck for an unexpected length
of time.
It’s monitors microcontroller (MCU) programs to see if they
are out of control or have stopped operating.
11/2/2023 18
Watch Dog Timer (WDT)
The instruction set of PIC is divided into Three basic categories. They are
(a) Byte oriented Instructions
(b) Bit oriented Instructions
(c) Literal and Control Instructions
Byte oriented Instructions:
❖ In a byte oriented Instructions ‘f “ represents a file register and’ d’ represents
destination register.
❖ The destination specifies where the result of operation is to be placed. If D= 0
the result is placed in W register(Accumulator).
11/2/2023 19
INSTRUCTION SET
11/2/2023 20
Bit oriented Instructions:
11/2/2023 21
Literal and Control Instructions:
11/2/2023 22
The PIC 18 microcontroller supports following addressing
modes.
1. Immediate addressing mode
2. Direct addressing mode
3. Register addressing mode
4. Indexed ROM addressing mode
1. Immediate addressing mode:
❖ In immediate addressing mode, the immediate data is
specified in the instruction.
❖ The immediate addressing mode is used to load the data into
PIC registers and W register.
❖ However, it cannot use to load data into any of the file
register.
❖ Example: 1. MOVLW 50H
❖ 2. ANDLW 40H
❖ 3. IORLW 60H
11/2/2023 23
Addressing Modes
2. Direct addressing mode:
❖ In direct addressing mode, the 8- bit data in RAM memory location whose address is
specified in the instruction.
❖ This mode is used for accessing the RAM file register.
❖ Example: 1. MOVWF 0X10
2. MOVFF 0X30, PORT C
3. Register addressing mode
❖ Register indirect addressing mode is used for accessing data stored in the RAM part of
file register.
❖ In this addressing mode a register is used as pointer to the memory location of the file
register.
❖ Three file select registers are used.
❖ They are FSR0, FSR1 and FSR2.
❖ Example:
1. MOVWF FSR2
2.MOVWF FSR0
3.MOVWF FSR1
[FSR – (File Select Register):]
It is the pointer used for indirect addressing. In the indirect addressing mode the 8-bit
register file address is first written into FSR. It is a special purpose register that serves as
an address pointer to any address through out the entire register file.
11/2/2023 24
4. Indexed ROM addressing mode:
❖ This addressing mode is used for accessing the data from look
up tables that reside in the PIC program ROM.
11/2/2023 25
26
REGISTER FILE MAP
The special function registers are also
memory registers which is used for special
dedicated functions.
These registers perform various dedicated
functions inside the PIC chip.
Each special function inside this PIC chip is
controlled by using these registers.
These registers are used by the CPU and
peripheral modules for controlling the
desired operation of the device.
27
SPECIAL FUNCTION
REGISTERS
28
SFRs IN BANK 0
29
SFRs IN BANK 1
30
SFRs IN BANK 2 and 3

More Related Content

Similar to UNIT-V (PIC16F877-Microcontrollers).pdf

Introduction to 8085 Microprocessors
Introduction to 8085 MicroprocessorsIntroduction to 8085 Microprocessors
Introduction to 8085 MicroprocessorsVeerakumar S
 
8085 microprocessor
8085 microprocessor8085 microprocessor
8085 microprocessorAnuja Gunale
 
Microprocessor Basics 8085 Ch-1
Microprocessor Basics 8085 Ch-1Microprocessor Basics 8085 Ch-1
Microprocessor Basics 8085 Ch-1Neelam Kapoor
 
Microcontroller pic 16 f877 registers memory ports
Microcontroller pic 16 f877 registers memory portsMicrocontroller pic 16 f877 registers memory ports
Microcontroller pic 16 f877 registers memory portsNilesh Bhaskarrao Bahadure
 
Chp4 introduction to the pic microcontroller copy
Chp4 introduction to the pic microcontroller   copyChp4 introduction to the pic microcontroller   copy
Chp4 introduction to the pic microcontroller copymkazree
 
An Overview of LPC2101/02/03
An Overview of LPC2101/02/03An Overview of LPC2101/02/03
An Overview of LPC2101/02/03Premier Farnell
 
Overview of Microcontroller and ATMega32 microcontroller
Overview of Microcontroller and ATMega32 microcontrollerOverview of Microcontroller and ATMega32 microcontroller
Overview of Microcontroller and ATMega32 microcontrollerRup Chowdhury
 
UNIT 1 Microprocessors.pptx
UNIT 1 Microprocessors.pptxUNIT 1 Microprocessors.pptx
UNIT 1 Microprocessors.pptxGowrishankar C
 
Overview of LPC213x MCUs
Overview of LPC213x MCUsOverview of LPC213x MCUs
Overview of LPC213x MCUsPremier Farnell
 
PIC Presentation_final updated.pptx
PIC Presentation_final updated.pptxPIC Presentation_final updated.pptx
PIC Presentation_final updated.pptxShabanamTamboli1
 
Introduction to 8085 Microprocessor
Introduction to 8085 MicroprocessorIntroduction to 8085 Microprocessor
Introduction to 8085 MicroprocessorRavi Anand
 
Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)IJERD Editor
 
VJITSk 6713 user manual
VJITSk 6713 user manualVJITSk 6713 user manual
VJITSk 6713 user manualkot seelam
 

Similar to UNIT-V (PIC16F877-Microcontrollers).pdf (20)

Introduction to 8085 Microprocessors
Introduction to 8085 MicroprocessorsIntroduction to 8085 Microprocessors
Introduction to 8085 Microprocessors
 
8085 microprocessor
8085 microprocessor8085 microprocessor
8085 microprocessor
 
002079
002079002079
002079
 
Microprocessor Basics 8085 Ch-1
Microprocessor Basics 8085 Ch-1Microprocessor Basics 8085 Ch-1
Microprocessor Basics 8085 Ch-1
 
Architecture of 8085
Architecture of 8085Architecture of 8085
Architecture of 8085
 
Architecture of 8085
Architecture of 8085Architecture of 8085
Architecture of 8085
 
Microcontroller pic 16 f877 registers memory ports
Microcontroller pic 16 f877 registers memory portsMicrocontroller pic 16 f877 registers memory ports
Microcontroller pic 16 f877 registers memory ports
 
Chp4 introduction to the pic microcontroller copy
Chp4 introduction to the pic microcontroller   copyChp4 introduction to the pic microcontroller   copy
Chp4 introduction to the pic microcontroller copy
 
An Overview of LPC2101/02/03
An Overview of LPC2101/02/03An Overview of LPC2101/02/03
An Overview of LPC2101/02/03
 
Overview of Microcontroller and ATMega32 microcontroller
Overview of Microcontroller and ATMega32 microcontrollerOverview of Microcontroller and ATMega32 microcontroller
Overview of Microcontroller and ATMega32 microcontroller
 
UNIT 1 Microprocessors.pptx
UNIT 1 Microprocessors.pptxUNIT 1 Microprocessors.pptx
UNIT 1 Microprocessors.pptx
 
Module 1 8086
Module 1 8086Module 1 8086
Module 1 8086
 
Overview of LPC213x MCUs
Overview of LPC213x MCUsOverview of LPC213x MCUs
Overview of LPC213x MCUs
 
PIC Presentation_final updated.pptx
PIC Presentation_final updated.pptxPIC Presentation_final updated.pptx
PIC Presentation_final updated.pptx
 
PIC
PICPIC
PIC
 
Introduction to 8085 Microprocessor
Introduction to 8085 MicroprocessorIntroduction to 8085 Microprocessor
Introduction to 8085 Microprocessor
 
Introduction to embedded systems
Introduction to embedded systemsIntroduction to embedded systems
Introduction to embedded systems
 
Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)
 
Qb microprocessors
Qb microprocessorsQb microprocessors
Qb microprocessors
 
VJITSk 6713 user manual
VJITSk 6713 user manualVJITSk 6713 user manual
VJITSk 6713 user manual
 

Recently uploaded

(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 

Recently uploaded (20)

(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 

UNIT-V (PIC16F877-Microcontrollers).pdf

  • 3. 8 bit microcontroller. Operating Speed: Up to 20 MHz Flash program memory (14 bit words), 8KB. Data memory:Data SRAM: 368 bytes &Data EEPROM: 256 bytes. Power-saving Sleep mode. 5 input/output ports It has 15 interrupt signal. Three timers 35 instructions 10bit A/D module (8 channels) In-Circuit Serial Programming via two pins (5V) Watchdog Timer with on-chip RC oscillator. 11/2/2023 3 FEATURES
  • 5. The main features of PIC microcontrollers are RAM, flash memory, Timers/ Counters, EEPROM, I/O Ports, USART, CCP (Capture/Compare/PWM module), SSP, Comparator, ADC (analog to digital converter), PSP(parallel slave port), LCD and ICSP (in circuit serial programming) . The PIC microcontroller architecture comprises of CPU, I/O ports, memory organization, A/D converter, timers/counters, interrupts, serial communication, oscillator and CCP module which are discussed in detailed below. 11/2/2023 5 Architecture of PIC16F877 MICROCONTROLLER
  • 7. 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. 11/2/2023 7 CPU (Central Processing Unit)
  • 8. The memory module in the PIC microcontroller architecture consists of 1. Data Memory (RAM) 2. Data EEPROM 3. Program Memory (FLASH Type) 11/2/2023 8 Memory Organization
  • 9. RAM is an unstable memory which is used to store the data temporarily in its registers. The RAM memory is classified into two banks, and each bank consists of so many registers. The RAM registers are classified into two types: 1.Special Function Registers (SFR) 2. General Purpose Registers (GPR). 11/2/2023 9 1.Random Access Memory (RAM)
  • 10. 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 11/2/2023 10
  • 11. 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 1. EECON1 2.EECON2 3.EEDATA 4.EEDATH 5.EEADR 6.EEADRH 11/2/2023 11 2.DATA EEPROM:
  • 12. 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 microcontroller, we erase an old program and write a new one. 11/2/2023 12 3. Program Memory (FLASH Type)
  • 13. Serial communication is the method of transferring data one bit at a time sequentially over a communication channel. There are three protocols of serial communication: 1.USART 2.SPI (Serial Peripheral Interface) 3.I2C (Inter Integrated Circuit) 1.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. 11/2/2023 13 Serial Communication
  • 14. 2.SPI (Serial Peripheral Interface) ❖ 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. 3.I2C (Inter Integrated Circuit) ❖ 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. 11/2/2023 14
  • 15. Interrupts ❖ There are 15 internal interrupts in PIC microcontrollers which are related with different peripherals like ADC, USART, Timers, and CCP etc. Timers/ Counters ❖ PIC microcontroller has 3 timer/counters (T0,T1,T2) where in the one 8-bit timer and the remaining timers have the choice to select 8 or 16-bit mode. ❖ Timers are used for generating specific time delays between two operations. A/D Converter: ❖ It converts the analog voltage levels to digital voltage values. In PIC Microcontroller, ADC has 8-channels and has resolution of 10-bit. ❖ The special function registers ADCON0 and ADCON1 control the operation of ADC. 11/2/2023 15
  • 16. CCP module: The name CCP module stands for capture/compare/PWM where it works in three modes such as capture mode, compare mode and PWM mode. Capture Mode: Capture mode captures the time of arrival of a signal. Compare Mode: Compare mode acts as an analog comparator. PWM Mode: PWM mode provides pulse width modulated output with a 10-bit resolution and programmable duty cycle. Oscillators Oscillators are used for timing generation. PIC microcontroller consist of external oscillators like RC oscillators or crystal oscillators. The range of clock frequency is upto 20MHz. 11/2/2023 16
  • 17. Input/Output Ports The series of PIC16f877 consists of five ports such as Port A, Port B, Port C, Port D & Port E. ❖ Port A is an 6-bit port that can be used as input or output port based on the status of the TRISA (Tradoc Intelligence Support Activity) register. ❖ Port B is an 8- bit port that can be used as both input and output port. ❖ Port C is an 8-bit port that can be used as input or output port based on the status of the TRISC register. ❖ Port D is an 8-bit port acts as a slave port for connection to the microprocessor BUS. ❖ Port E is a 3-bit port which serves the additional function of the control signals to the analog to digital converter. 11/2/2023 17
  • 18. Watchdog timer is a timer that resets the microcontroller in case the program gets stuck for an unexpected length of time. It’s monitors microcontroller (MCU) programs to see if they are out of control or have stopped operating. 11/2/2023 18 Watch Dog Timer (WDT)
  • 19. The instruction set of PIC is divided into Three basic categories. They are (a) Byte oriented Instructions (b) Bit oriented Instructions (c) Literal and Control Instructions Byte oriented Instructions: ❖ In a byte oriented Instructions ‘f “ represents a file register and’ d’ represents destination register. ❖ The destination specifies where the result of operation is to be placed. If D= 0 the result is placed in W register(Accumulator). 11/2/2023 19 INSTRUCTION SET
  • 22. Literal and Control Instructions: 11/2/2023 22
  • 23. The PIC 18 microcontroller supports following addressing modes. 1. Immediate addressing mode 2. Direct addressing mode 3. Register addressing mode 4. Indexed ROM addressing mode 1. Immediate addressing mode: ❖ In immediate addressing mode, the immediate data is specified in the instruction. ❖ The immediate addressing mode is used to load the data into PIC registers and W register. ❖ However, it cannot use to load data into any of the file register. ❖ Example: 1. MOVLW 50H ❖ 2. ANDLW 40H ❖ 3. IORLW 60H 11/2/2023 23 Addressing Modes
  • 24. 2. Direct addressing mode: ❖ In direct addressing mode, the 8- bit data in RAM memory location whose address is specified in the instruction. ❖ This mode is used for accessing the RAM file register. ❖ Example: 1. MOVWF 0X10 2. MOVFF 0X30, PORT C 3. Register addressing mode ❖ Register indirect addressing mode is used for accessing data stored in the RAM part of file register. ❖ In this addressing mode a register is used as pointer to the memory location of the file register. ❖ Three file select registers are used. ❖ They are FSR0, FSR1 and FSR2. ❖ Example: 1. MOVWF FSR2 2.MOVWF FSR0 3.MOVWF FSR1 [FSR – (File Select Register):] It is the pointer used for indirect addressing. In the indirect addressing mode the 8-bit register file address is first written into FSR. It is a special purpose register that serves as an address pointer to any address through out the entire register file. 11/2/2023 24
  • 25. 4. Indexed ROM addressing mode: ❖ This addressing mode is used for accessing the data from look up tables that reside in the PIC program ROM. 11/2/2023 25
  • 27. The special function registers are also memory registers which is used for special dedicated functions. These registers perform various dedicated functions inside the PIC chip. Each special function inside this PIC chip is controlled by using these registers. These registers are used by the CPU and peripheral modules for controlling the desired operation of the device. 27 SPECIAL FUNCTION REGISTERS
  • 30. 30 SFRs IN BANK 2 and 3