SlideShare a Scribd company logo
1 of 35
PIC 16F877A
06/08/13S. PARTHIBAN, M. TECH.1

The term PIC or Peripheral Interface Controller,
has been coined by Microchip Technology Inc.

Low-end range, mid-range and high end range of
controllers.
What is PIC?
06/08/13S. PARTHIBAN, M. TECH.2
We’re used to the Von-Neuman Architecture

Used in: 80X86 (PCs), 8051, 68HC11, etc.)

Only one bus between CPU and memory

RAM and program memory share the same bus and
the same memory, and so must have the same bit
width

Bottleneck: Getting instructions interferes with
accessing RAM
CPU
8
Memory
(& Data)
PIC Architecture: Background
06/08/13S. PARTHIBAN, M. TECH.3
PICs use the Harvard Architecture
Used mostly in RISC CPUs (we’ll get there)

Separate program bus and data bus: can be
different widths!

For example, PICs use:

Data memory (RAM): a small number of 8bit
registers

Program memory (ROM): 12bit, 14bit or 16bit
wide (in EPROM, FLASH, or ROM)
CPU
12
14
16
Memory
(Data)
8
Memory
(Program)
PIC Architecture: Background
06/08/13S. PARTHIBAN, M. TECH.4
Traditionally, CPUs are “CISC”

Complex Instruction Set Computer (CISC)

Used in: 80X86, 8051, 68HC11, etc.

Many instructions (usually > 100)

Many, many addressing modes

Usually takes more than 1 internal clock cycle
(T cycle) to execute

Example:
MC68HC05: LDAA 0x55
01010101
1000 1100
2 bytes, 2 cycles
CISC
06/08/13S. PARTHIBAN, M. TECH.5
PICs and most Harvard chips are “RISC”

Reduced Instruction Set Computer (RISC)

Used in: SPARC, ALPHA, Atmel AVR, etc.

Few instructions (usually < 50)

Only a few addressing modes

Executes 1 instruction in 1 internal clock cycle
(Tcyc)

Example:
PIC16CXXX: MOVLW 0x55
1 word, 1 cycle
1100XX 01010101
RISC
06/08/13S. PARTHIBAN, M. TECH.6

High performance RISC CPU with 35 no. of
instruction set only

Harvard Architecture

Pipelined Instructions

And a large number of Peripherals In-built
What is New in PIC?
06/08/13S. PARTHIBAN, M. TECH.7
Pin Diagram
06/08/13S. PARTHIBAN, M. TECH.8

8kB of flash program
memory

368bytes of Data
memory

256-EEPROM data
memory

15 Interrupts

In-circuit programming

3 internal hardware
timers

Capture/Compare/PW
M modules

Up to 8 channels of 10-
Bit A/D

Built-in USART for
serial communication

5 digital I/O ports (Up
to 22 lines)
Features
06/08/13S. PARTHIBAN, M. TECH.9

PIC 16F877A has FIVE I/O Ports

A total of 33 pins are used for I/O operations.
PORT A

Port A is 6 bit wide and bi-directional.

Its corresponding data direction register is TRISA.

If TRISA port pin is set to 1,corresponding port A pin
will act as an input pin and vice versa.

Port A is used for analog inputs.
I/O Ports
06/08/13S. PARTHIBAN, M. TECH.10

Port B is 8 bit wide and bi-directional.

Its corresponding data direction register is TRISB.

If TRISB port pin is set to 1,corresponding port B
pin will act as an input pin and vice versa.

Port B is used for Data Transmission.
Port B
06/08/13S. PARTHIBAN, M. TECH.11

Port C is 8 bit wide and bi-directional.

Its corresponding data direction register is TRISC.

If TRISC port pin is set to 1,corresponding port C
pin will act as an input pin and vice versa.

Port C is used for control registers(serial
communication, I2C functions,serial data transfer).
Port C
06/08/13S. PARTHIBAN, M. TECH.12

Port D is 8 bit wide and bi-directional.

Its corresponding data direction register is
TRISD.

If TRISD port pin is set to 1,corresponding port D
pin will act as an input pin and vice versa.

Port D is used as Data port
Port D
06/08/13S. PARTHIBAN, M. TECH.13

Port E is 3 bit wide . They are for read, write and
chip select operation.

Each pin is individually configurable as inputs
and outputs.

Port E is generally used for controlling purposes.
Port E
06/08/13S. PARTHIBAN, M. TECH.14
4 cycles per4 cycles per instruction on the PIC16F87x
micro controllers. instruction on the PIC16F87x micro
controllers.
Clock
Read
Instruction
Decode
Instruction
Execute
Instruction
Store Result
T1 T2 T3 T4
Oscillator circuits generate a clock signal.
Machine Cycle
06/08/13S. PARTHIBAN, M. TECH.15

A Machine cycle is the time taken for a data
transfer from or to memory/ I/O Ports.

Machine cycle is calculated using the formula:
Clock Frequency=6.144MHz
Machine cycle frequency= 6.144 MHz /4
Hence 1 Machine cycle(Time taken for a data
transfer)= 1/T
= 4/ 6.144 MHz
= 0.651 µs
Calculations
06/08/13S. PARTHIBAN, M. TECH.16

An instruction cycle is the time taken to complete
an instruction.

All instructions in 16F877A are single cycle
instructions except for Branching instruction. They
take two machine cycles to complete an
instruction.
Instruction Cycle
06/08/13S. PARTHIBAN, M. TECH.17
Different PICs have different on-board peripherals some
common peripherals are:

3 Timers (0 & 2- 8bits, 1-16 bits)

2 Compare/Capture/PWM Modules

Analog to Digital Converters (ADC) (8, 10 and 12bit,
50ksps)

Serial communications: UART (RS-232C), SPI, I2
C,
CAN

Pulse Width Modulation (PWM) (10bit)

Voltage Comparators

Voltage Reference Modules

MSSP – Master Synchronous Serial Port

I2C (Master and Slave)

SPI (Master and Slave)

Watchdog timers, Brown out detect, LCD drivers
PIC overview
06/08/13S. PARTHIBAN, M. TECH.18

Instructions

Memory Organisation
Overview
06/08/13S. PARTHIBAN, M. TECH.19
06/08/13S. PARTHIBAN, M. TECH.20

The data memory partitioned into General Purpose
registers and Special Function Registers.

Bits RP1 and RP0 are the bank select bits.
RP1 RP0 Bank
0 0 0
0 1 1
1 0 2
1 1 3
Data Memory Organisation
06/08/13S. PARTHIBAN, M. TECH.21
06/08/13S. PARTHIBAN, M. TECH.22
PIC16F877A has 3 Timers

Timer 0 - 8 bit
can be used as a Timer/counter

Timer 1 – 16 bit
can be used as a Timer/counter

Timer 2 – 8 bit Timer
can be used as the PWM time-base for the PWM
mode of the CCP module.
Timers
06/08/13S. PARTHIBAN, M. TECH.23
06/08/13S. PARTHIBAN, M. TECH.24

The data registers of Timer 1 are TMR1H and
TMR1L.

The 16 bit value to be loaded in the timer is given to
Data registers

The Control register is T1CON.

The timer ON and oscillator enable operations are
controlled through the control register.

To determine if the timer has completed its operation,
the timer overflow bit TMR1IF of the PIR1 register is
checked continuously.
Timer 1
06/08/13S. PARTHIBAN, M. TECH.25

Universal synchronous asynchronous receiver
transmitter is also known as a serial
communication interface.

USART can be configured in the following
modes:

Asynchronous - FULL DUPLEX

synchronous - HALF DUPLEX
USART
06/08/13S. PARTHIBAN, M. TECH.26

For serial Communication, the SFR involved are
TXSTA, TXREG, RCSTA,,RCREG and SPBRG.

SPBRG is used to set the required baud rate.

In TXSTA,TXEN is set high to enable
transmission.

The transmitted data is stored in a temporary
buffer,TXREG.

In RCSTA, SPEN and CREN are set high to enable
reception.

The received data is stored in a temporary buffer,
RCREG.
Serial Communication
06/08/13S. PARTHIBAN, M. TECH.27
06/08/13S. PARTHIBAN, M. TECH.28
06/08/13S. PARTHIBAN, M. TECH.29
06/08/13S. PARTHIBAN, M. TECH.30
FOR BAUD RATE:
For asynchronous mode,
Baud rate=Fosc / 64(x+1)
For synchronous mode,
Baud rate=Fosc / 4(x+1)
FOR RECEPTION:
Check RCIF flag till it is set. This indicates that the data is
completely received in the RCREG. Move this value to working
register for further manipulation.
FOR TRANSMISSION:
To transmit the calculated data, move the value to TXREG. Check
the TXIF flag till it is set. This indicates that the data is completely
transmitted out.
06/08/13S. PARTHIBAN, M. TECH.31
06/08/13
S. PARTHIBAN, M. TECH.
32

PIC16F877A has 15 sources of interrupts.

Only one vector location is allocated for the
interrupts.

The Global interrupt enable bit is set, so that any
interrupt can be acknowledged.

Regardless of the Global enable bit, the user
should ensure,the appropriate interrupt flag bits
that needs to be executed, is also set.
Interrupts
06/08/13S. PARTHIBAN, M. TECH.33
06/08/13S. PARTHIBAN, M. TECH.34
Thank You
06/08/13S. PARTHIBAN, M. TECH.35

More Related Content

What's hot

Pic 18 microcontroller
Pic 18 microcontrollerPic 18 microcontroller
Pic 18 microcontrollerAshish Ranjan
 
Arm architecture chapter2_steve_furber
Arm architecture chapter2_steve_furberArm architecture chapter2_steve_furber
Arm architecture chapter2_steve_furberasodariyabhavesh
 
PIC 16F877 micro controller by Gaurav raikar
PIC 16F877 micro controller by Gaurav raikarPIC 16F877 micro controller by Gaurav raikar
PIC 16F877 micro controller by Gaurav raikarGauravRaikar3
 
Unit II Arm 7 Introduction
Unit II Arm 7 IntroductionUnit II Arm 7 Introduction
Unit II Arm 7 IntroductionDr. Pankaj Zope
 
LPC 2148 ARM MICROCONTROLLER
LPC 2148 ARM MICROCONTROLLERLPC 2148 ARM MICROCONTROLLER
LPC 2148 ARM MICROCONTROLLERsravannunna24
 
8051 MICROCONTROLLER ARCHITECTURE.pptx
 8051 MICROCONTROLLER ARCHITECTURE.pptx 8051 MICROCONTROLLER ARCHITECTURE.pptx
8051 MICROCONTROLLER ARCHITECTURE.pptxMemonaMemon1
 
Microcontroller pic 16f877 addressing modes instructions and programming
Microcontroller pic 16f877 addressing modes instructions and programmingMicrocontroller pic 16f877 addressing modes instructions and programming
Microcontroller pic 16f877 addressing modes instructions and programmingNilesh Bhaskarrao Bahadure
 
8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil Kaware8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil KawareProf. Swapnil V. Kaware
 
Interrupts for PIC18
Interrupts for PIC18Interrupts for PIC18
Interrupts for PIC18raosandy11
 
Arm7 Interfacing examples
Arm7   Interfacing examples Arm7   Interfacing examples
Arm7 Interfacing examples Dr.YNM
 
Introduction to arm architecture
Introduction to arm architectureIntroduction to arm architecture
Introduction to arm architectureZakaria Gomaa
 
Serial Communication
Serial CommunicationSerial Communication
Serial CommunicationUshaRani289
 

What's hot (20)

Pic 18 microcontroller
Pic 18 microcontrollerPic 18 microcontroller
Pic 18 microcontroller
 
Arm architecture chapter2_steve_furber
Arm architecture chapter2_steve_furberArm architecture chapter2_steve_furber
Arm architecture chapter2_steve_furber
 
Interrupts of microprocessor 8085
Interrupts of microprocessor  8085Interrupts of microprocessor  8085
Interrupts of microprocessor 8085
 
PIC 16F877 micro controller by Gaurav raikar
PIC 16F877 micro controller by Gaurav raikarPIC 16F877 micro controller by Gaurav raikar
PIC 16F877 micro controller by Gaurav raikar
 
SPI Bus Protocol
SPI Bus ProtocolSPI Bus Protocol
SPI Bus Protocol
 
Unit II Arm 7 Introduction
Unit II Arm 7 IntroductionUnit II Arm 7 Introduction
Unit II Arm 7 Introduction
 
LPC 2148 ARM MICROCONTROLLER
LPC 2148 ARM MICROCONTROLLERLPC 2148 ARM MICROCONTROLLER
LPC 2148 ARM MICROCONTROLLER
 
LCD Interacing with 8051
LCD Interacing with 8051LCD Interacing with 8051
LCD Interacing with 8051
 
8051 MICROCONTROLLER ARCHITECTURE.pptx
 8051 MICROCONTROLLER ARCHITECTURE.pptx 8051 MICROCONTROLLER ARCHITECTURE.pptx
8051 MICROCONTROLLER ARCHITECTURE.pptx
 
Interfacing Stepper motor with 8051
Interfacing Stepper motor with 8051Interfacing Stepper motor with 8051
Interfacing Stepper motor with 8051
 
UART
UARTUART
UART
 
Microcontroller pic 16f877 addressing modes instructions and programming
Microcontroller pic 16f877 addressing modes instructions and programmingMicrocontroller pic 16f877 addressing modes instructions and programming
Microcontroller pic 16f877 addressing modes instructions and programming
 
ARM Architecture
ARM ArchitectureARM Architecture
ARM Architecture
 
8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil Kaware8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil Kaware
 
Interrupts for PIC18
Interrupts for PIC18Interrupts for PIC18
Interrupts for PIC18
 
Arm7 Interfacing examples
Arm7   Interfacing examples Arm7   Interfacing examples
Arm7 Interfacing examples
 
PIC Microcontrollers
PIC MicrocontrollersPIC Microcontrollers
PIC Microcontrollers
 
Introduction to arm architecture
Introduction to arm architectureIntroduction to arm architecture
Introduction to arm architecture
 
8051 timer counter
8051 timer counter8051 timer counter
8051 timer counter
 
Serial Communication
Serial CommunicationSerial Communication
Serial Communication
 

Similar to PIC 16F877A by PARTHIBAN. S.

8096 microcontrollers notes
8096 microcontrollers notes8096 microcontrollers notes
8096 microcontrollers notesDr.YNM
 
8086 slide general short notes assembly languages.pptx
8086 slide general short notes assembly languages.pptx8086 slide general short notes assembly languages.pptx
8086 slide general short notes assembly languages.pptxbinaboss24
 
Architecture of 8085
Architecture of 8085Architecture of 8085
Architecture of 8085ShivamSood22
 
PIC16F877A interfacing with LCD
PIC16F877A interfacing with LCDPIC16F877A interfacing with LCD
PIC16F877A interfacing with LCDsunil polo
 
Microprocessor and microcontroller
Microprocessor and microcontrollerMicroprocessor and microcontroller
Microprocessor and microcontrollerRavinder Singla
 
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
 
Notes-7_complete notes_8086.pdf
Notes-7_complete notes_8086.pdfNotes-7_complete notes_8086.pdf
Notes-7_complete notes_8086.pdfVisheshYadav38
 
Introduction to 8085 Microprocessor
Introduction to 8085 MicroprocessorIntroduction to 8085 Microprocessor
Introduction to 8085 MicroprocessorRavi Anand
 
UNIT-II-8086.pptx
UNIT-II-8086.pptxUNIT-II-8086.pptx
UNIT-II-8086.pptxparul757596
 
Microprocessors and microcontrollers
Microprocessors and microcontrollersMicroprocessors and microcontrollers
Microprocessors and microcontrollersgomathy S
 

Similar to PIC 16F877A by PARTHIBAN. S. (20)

8096 microcontrollers notes
8096 microcontrollers notes8096 microcontrollers notes
8096 microcontrollers notes
 
8086 new
8086 new8086 new
8086 new
 
Microprocessor 8086
Microprocessor 8086Microprocessor 8086
Microprocessor 8086
 
8086 mprocessor.pptx
8086 mprocessor.pptx8086 mprocessor.pptx
8086 mprocessor.pptx
 
8086 complete guide
8086 complete guide 8086 complete guide
8086 complete guide
 
8086 Microprocessor
8086 Microprocessor8086 Microprocessor
8086 Microprocessor
 
8086 introduction.pptx
8086 introduction.pptx8086 introduction.pptx
8086 introduction.pptx
 
8086.pptx
8086.pptx8086.pptx
8086.pptx
 
8086 slide general short notes assembly languages.pptx
8086 slide general short notes assembly languages.pptx8086 slide general short notes assembly languages.pptx
8086 slide general short notes assembly languages.pptx
 
Architecture of 8085
Architecture of 8085Architecture of 8085
Architecture of 8085
 
8086slide
8086slide8086slide
8086slide
 
8085_LAB_PROGRAMS.pdf
8085_LAB_PROGRAMS.pdf8085_LAB_PROGRAMS.pdf
8085_LAB_PROGRAMS.pdf
 
PIC16F877A interfacing with LCD
PIC16F877A interfacing with LCDPIC16F877A interfacing with LCD
PIC16F877A interfacing with LCD
 
Microprocessor and microcontroller
Microprocessor and microcontrollerMicroprocessor and microcontroller
Microprocessor and microcontroller
 
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
 
Notes-7_complete notes_8086.pdf
Notes-7_complete notes_8086.pdfNotes-7_complete notes_8086.pdf
Notes-7_complete notes_8086.pdf
 
8086 microprocessor
8086 microprocessor8086 microprocessor
8086 microprocessor
 
Introduction to 8085 Microprocessor
Introduction to 8085 MicroprocessorIntroduction to 8085 Microprocessor
Introduction to 8085 Microprocessor
 
UNIT-II-8086.pptx
UNIT-II-8086.pptxUNIT-II-8086.pptx
UNIT-II-8086.pptx
 
Microprocessors and microcontrollers
Microprocessors and microcontrollersMicroprocessors and microcontrollers
Microprocessors and microcontrollers
 

Recently uploaded

Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWQuiz Club NITW
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsPooky Knightsmith
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Association for Project Management
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxMichelleTuguinay1
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 

Recently uploaded (20)

Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITW
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young minds
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of EngineeringFaculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptxINCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
 

PIC 16F877A by PARTHIBAN. S.

  • 2.  The term PIC or Peripheral Interface Controller, has been coined by Microchip Technology Inc.  Low-end range, mid-range and high end range of controllers. What is PIC? 06/08/13S. PARTHIBAN, M. TECH.2
  • 3. We’re used to the Von-Neuman Architecture  Used in: 80X86 (PCs), 8051, 68HC11, etc.)  Only one bus between CPU and memory  RAM and program memory share the same bus and the same memory, and so must have the same bit width  Bottleneck: Getting instructions interferes with accessing RAM CPU 8 Memory (& Data) PIC Architecture: Background 06/08/13S. PARTHIBAN, M. TECH.3
  • 4. PICs use the Harvard Architecture Used mostly in RISC CPUs (we’ll get there)  Separate program bus and data bus: can be different widths!  For example, PICs use:  Data memory (RAM): a small number of 8bit registers  Program memory (ROM): 12bit, 14bit or 16bit wide (in EPROM, FLASH, or ROM) CPU 12 14 16 Memory (Data) 8 Memory (Program) PIC Architecture: Background 06/08/13S. PARTHIBAN, M. TECH.4
  • 5. Traditionally, CPUs are “CISC”  Complex Instruction Set Computer (CISC)  Used in: 80X86, 8051, 68HC11, etc.  Many instructions (usually > 100)  Many, many addressing modes  Usually takes more than 1 internal clock cycle (T cycle) to execute  Example: MC68HC05: LDAA 0x55 01010101 1000 1100 2 bytes, 2 cycles CISC 06/08/13S. PARTHIBAN, M. TECH.5
  • 6. PICs and most Harvard chips are “RISC”  Reduced Instruction Set Computer (RISC)  Used in: SPARC, ALPHA, Atmel AVR, etc.  Few instructions (usually < 50)  Only a few addressing modes  Executes 1 instruction in 1 internal clock cycle (Tcyc)  Example: PIC16CXXX: MOVLW 0x55 1 word, 1 cycle 1100XX 01010101 RISC 06/08/13S. PARTHIBAN, M. TECH.6
  • 7.  High performance RISC CPU with 35 no. of instruction set only  Harvard Architecture  Pipelined Instructions  And a large number of Peripherals In-built What is New in PIC? 06/08/13S. PARTHIBAN, M. TECH.7
  • 9.  8kB of flash program memory  368bytes of Data memory  256-EEPROM data memory  15 Interrupts  In-circuit programming  3 internal hardware timers  Capture/Compare/PW M modules  Up to 8 channels of 10- Bit A/D  Built-in USART for serial communication  5 digital I/O ports (Up to 22 lines) Features 06/08/13S. PARTHIBAN, M. TECH.9
  • 10.  PIC 16F877A has FIVE I/O Ports  A total of 33 pins are used for I/O operations. PORT A  Port A is 6 bit wide and bi-directional.  Its corresponding data direction register is TRISA.  If TRISA port pin is set to 1,corresponding port A pin will act as an input pin and vice versa.  Port A is used for analog inputs. I/O Ports 06/08/13S. PARTHIBAN, M. TECH.10
  • 11.  Port B is 8 bit wide and bi-directional.  Its corresponding data direction register is TRISB.  If TRISB port pin is set to 1,corresponding port B pin will act as an input pin and vice versa.  Port B is used for Data Transmission. Port B 06/08/13S. PARTHIBAN, M. TECH.11
  • 12.  Port C is 8 bit wide and bi-directional.  Its corresponding data direction register is TRISC.  If TRISC port pin is set to 1,corresponding port C pin will act as an input pin and vice versa.  Port C is used for control registers(serial communication, I2C functions,serial data transfer). Port C 06/08/13S. PARTHIBAN, M. TECH.12
  • 13.  Port D is 8 bit wide and bi-directional.  Its corresponding data direction register is TRISD.  If TRISD port pin is set to 1,corresponding port D pin will act as an input pin and vice versa.  Port D is used as Data port Port D 06/08/13S. PARTHIBAN, M. TECH.13
  • 14.  Port E is 3 bit wide . They are for read, write and chip select operation.  Each pin is individually configurable as inputs and outputs.  Port E is generally used for controlling purposes. Port E 06/08/13S. PARTHIBAN, M. TECH.14
  • 15. 4 cycles per4 cycles per instruction on the PIC16F87x micro controllers. instruction on the PIC16F87x micro controllers. Clock Read Instruction Decode Instruction Execute Instruction Store Result T1 T2 T3 T4 Oscillator circuits generate a clock signal. Machine Cycle 06/08/13S. PARTHIBAN, M. TECH.15
  • 16.  A Machine cycle is the time taken for a data transfer from or to memory/ I/O Ports.  Machine cycle is calculated using the formula: Clock Frequency=6.144MHz Machine cycle frequency= 6.144 MHz /4 Hence 1 Machine cycle(Time taken for a data transfer)= 1/T = 4/ 6.144 MHz = 0.651 µs Calculations 06/08/13S. PARTHIBAN, M. TECH.16
  • 17.  An instruction cycle is the time taken to complete an instruction.  All instructions in 16F877A are single cycle instructions except for Branching instruction. They take two machine cycles to complete an instruction. Instruction Cycle 06/08/13S. PARTHIBAN, M. TECH.17
  • 18. Different PICs have different on-board peripherals some common peripherals are:  3 Timers (0 & 2- 8bits, 1-16 bits)  2 Compare/Capture/PWM Modules  Analog to Digital Converters (ADC) (8, 10 and 12bit, 50ksps)  Serial communications: UART (RS-232C), SPI, I2 C, CAN  Pulse Width Modulation (PWM) (10bit)  Voltage Comparators  Voltage Reference Modules  MSSP – Master Synchronous Serial Port  I2C (Master and Slave)  SPI (Master and Slave)  Watchdog timers, Brown out detect, LCD drivers PIC overview 06/08/13S. PARTHIBAN, M. TECH.18
  • 21.  The data memory partitioned into General Purpose registers and Special Function Registers.  Bits RP1 and RP0 are the bank select bits. RP1 RP0 Bank 0 0 0 0 1 1 1 0 2 1 1 3 Data Memory Organisation 06/08/13S. PARTHIBAN, M. TECH.21
  • 23. PIC16F877A has 3 Timers  Timer 0 - 8 bit can be used as a Timer/counter  Timer 1 – 16 bit can be used as a Timer/counter  Timer 2 – 8 bit Timer can be used as the PWM time-base for the PWM mode of the CCP module. Timers 06/08/13S. PARTHIBAN, M. TECH.23
  • 25.  The data registers of Timer 1 are TMR1H and TMR1L.  The 16 bit value to be loaded in the timer is given to Data registers  The Control register is T1CON.  The timer ON and oscillator enable operations are controlled through the control register.  To determine if the timer has completed its operation, the timer overflow bit TMR1IF of the PIR1 register is checked continuously. Timer 1 06/08/13S. PARTHIBAN, M. TECH.25
  • 26.  Universal synchronous asynchronous receiver transmitter is also known as a serial communication interface.  USART can be configured in the following modes:  Asynchronous - FULL DUPLEX  synchronous - HALF DUPLEX USART 06/08/13S. PARTHIBAN, M. TECH.26
  • 27.  For serial Communication, the SFR involved are TXSTA, TXREG, RCSTA,,RCREG and SPBRG.  SPBRG is used to set the required baud rate.  In TXSTA,TXEN is set high to enable transmission.  The transmitted data is stored in a temporary buffer,TXREG.  In RCSTA, SPEN and CREN are set high to enable reception.  The received data is stored in a temporary buffer, RCREG. Serial Communication 06/08/13S. PARTHIBAN, M. TECH.27
  • 31. FOR BAUD RATE: For asynchronous mode, Baud rate=Fosc / 64(x+1) For synchronous mode, Baud rate=Fosc / 4(x+1) FOR RECEPTION: Check RCIF flag till it is set. This indicates that the data is completely received in the RCREG. Move this value to working register for further manipulation. FOR TRANSMISSION: To transmit the calculated data, move the value to TXREG. Check the TXIF flag till it is set. This indicates that the data is completely transmitted out. 06/08/13S. PARTHIBAN, M. TECH.31
  • 33.  PIC16F877A has 15 sources of interrupts.  Only one vector location is allocated for the interrupts.  The Global interrupt enable bit is set, so that any interrupt can be acknowledged.  Regardless of the Global enable bit, the user should ensure,the appropriate interrupt flag bits that needs to be executed, is also set. Interrupts 06/08/13S. PARTHIBAN, M. TECH.33