SlideShare una empresa de Scribd logo
1 de 34
PIC MICROCONTROLLER




              By : Osama Hasan
AN INTRODUCTION TO PIC MICROCONTROLLERS

- The name PIC was originally an acronym for "Programmable
Intelligent Computer".

- A PIC microcontroller is a processor with built in memory and
RAM and you can use it to control your projects.

- What this really means for you is that you have a very powerful
device that has many useful built in modules e.g.

* EEPROM.
* Timers.
* Analogue comparators.
* UART.
INTRODUCTION (CONT.)

Why PIC is popular?

   low cost ,wide availability with high clock speed
   availability of low cost or free development tools
   Only 37 instructions to remember
   serial programming and re-programming with flash
    memory capability
   Its code is extremely efficient, allowing the PIC to run
    with typically less program memory than its larger
    competitors
   PIC is very small and easy to implement for non-
    complex problems and usually accompanies to the
    microprocessors as an interface
TWO DIFFERENT ARCHITECTURES

   Harvard Architectures    Von-Neumann

        (newer arch.)        Architecture
TWO DIFFERENT ARCHITECTURES

   Harvard Architectures                 Von-Neumann Architecture




   Used mostly in RISC CPUs
                                          Used in: 80X86 (CISC PCs)
   Separate program bus and data
    bus: can be of different widths       Only one bus between CPU and
                                           memory
   For example, PICs use:                RAM and program memory
     Data memory (RAM): a small           share the same bus and the
      number of 8bit registers             same memory, and so must have
     Program memory (ROM):                the same bit width.
      12bit, 14bit or 16bit wide (in
      EPROM, FLASH, or ROM)
RISC VS. CISC
Complex Instruction Set Computer (CISC)

Is a computer where single instructions can execute several
low-level     operations       (such     as     a     load
from memory, an arithmetic operation, and a memory store)
and/or are capable of multi-step operations or addressing
modes within single instructions.

    Used in: 80X86, 8051, 68HC11, etc.
    Many instructions
       (usually > 100)
    Several addressing modes
    Usually takes more than 1 internal clock cycle (Tcyc) to
     execute
RISC VS. CISC
Reduced Instruction Set Computer (RISC)

Is a CPU design strategy based on the insight that simplified
instructions can provide higher performance if this simplicity enables
much faster execution of each instruction. A computer based on this
strategy is a reduced instruction set computer also called 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)
FAMILY CORE ARCHITECTURE DIFFERENCES

 The     PIC Family: Cores

     12bit cores with 33 instructions: 12C50x, 16C5x

     14bit cores with 35 instructions: 12C67x,16Cxxx

     16bit cores with 58 instructions: 17C4x,17C7xx

     ‘Enhanced’ 16bit cores with 77 instructions: 18Cxxx
THE PIC FAMILY: SPEED
 Can use crystals, clock oscillators, or even an RC circuit.
 Some PICs have a built in 4MHz RC clock, Not very
  accurate, but requires no external components!
 Instruction speed = 1/4 clock speed (Tcyc = 4 * Tclk)
 All PICs can be run from DC to their maximum specified
  speed:
                      12C50x            4MHz


                      12C67x            10MHz
                      16Cxxx            20MHz
                      17C4x / 17C7xxx   33MHz
                      18Cxxx            40MHz
CLOCK AND INSTRUCTION CYCLES
 Instruction     Clock
     Clock from the oscillator enters a microcontroller via OSC1 pin where
      internal circuit of a microcontroller divides the clock into four even clocks
      Q1, Q2, Q3, and Q4 which do not overlap.
     These four clocks make up one instruction cycle (also called machine cycle)
      during which one instruction is executed.
     Execution of instruction starts by calling an instruction that is next in string.
     Instruction is called from program memory on every Q1 and is written in
      instruction register on Q4.
     Decoding and execution of instruction are done between the next Q1 and Q4
      cycles. On the following diagram we can see the relationship between
      instruction cycle and clock of the oscillator (OSC1) as well as that of
      internal clocks Q1-Q4.
     Program counter (PC) holds information about the address of the next
      instruction.
CLOCK AND INSTRUCTION CYCLES (CONT.)
PIPELINING IN PIC
THE PIC FAMILY: PROGRAM MEMORY

 Technology: EPROM, FLASH, or ROM
 It varies in size from one chip to another.
       - examples:

       12C508          512            12bit
                                  instructions
       16C711       1024 (1k)         14bit
                                  instructions
       16F877       8192 (8k)         14bit
                                  instructions
       17C766      16384 (16k)        16bit
                                  instructions
MICROCHIP PIC 16F84 MICROCONTROLLER

High Performance RISC CPU:

Only 35 single word instructions to learn

All single cycle instructions except for program
branches, which are two-cycle

Operating speed: DC - 20 MHz clock input DC - 200
ns instruction cycle
MICROCHIP PIC 16F84 MICROCONTROLLER

Below is a diagram showing the pin-outs of the PIC 16F84. We will
go through each pin, explaining what each is used for.
MICROCHIP PIC 16F84 MICROCONTROLLER

RA0 To RA4
RA is a bidirectional port. That is, it can be
configured as an input or an output. The number
following RA is the bit number (0 to 4). So, we have
one 5-bit directional port where each bit can be
configured as Input or Output.
RB0 To RB7
RB is a second bidirectional port. It behaves in
exactly the same way as RA, except there are 8 -
bits involved.
MICROCHIP PIC 16F84 MICROCONTROLLER

VSS And VDD
These are the power supply pins. VDD is the
positive supply, and VSS is the negative
supply, or 0V. The maximum supply voltage that
you can use is 6V, and the minimum is 2V.

OSC1/CLK IN And OSC2/CLKOUT
These pins is where we connect an external
clock, so that the microcontroller has some kind
of timing.
MICROCHIP PIC 16F84 MICROCONTROLLER

MCLR
This pin is used to erase the memory locations
inside the PIC (i.e. when we want to re-program
it. In normal use it is connected to the positive
supply rail.

T0CK1
This is another clock input, which operates an
internal timer. It operates in isolation to the main
clock.
MICROCHIP PIC 16F84 MICROCONTROLLER

Below is a diagram showing the pin-outs of the PIC 16F84. We will
go through each pin, explaining what each is used for.


 PORT A




PORT B
PIC DATA MEMORY
The most
important
registers
have
addresses
in all the
four
banks




             The data memory is devided into 4 memory banks
THE REGISTERS
A register is a place inside the PIC that can be written to, read from
or both.

you will notice is that it is split into two - Bank 0 and Bank
1. Bank 1 is used to control the actual operation of the PIC, for
example to tell the PIC which bits of Port A are input and which
are output. Bank 0 is used to manipulate the data.


An example is as follows: Let us say we want to make one bit on
Port A high. First we need to go to Bank 1 to set the particular
bit, or pin, on Port A as an output. We then come back to Bank 0
and send a logic 1 (bit 1) to that pin.
THE REGISTERS

The most common registers in Bank 1 we are going to use are
STATUS, TRISA and TRISB. The first allows us to come back to
Bank 0, TRISA allows us to select which pins on Port A are output
and which are input, TRISB allows us to select which pins on Port B
are output and which are input. The SELECT register in Bank 0
allows us to switch to Bank 1.

STATUS
To change from Bank 0 to Bank 1 we tell the STAUS register. We do
this by setting bit 5 of the STATUS register to 1. To switch back to
Bank 0, we set bit 5 of the STATUS register to 0. The STATUS
register is located at address 03h.
THE REGISTERS

TRISA and TRISB.

These are located at addresses 85h and 86h respectively. To
program a pin to be an output or an input, we simply send a 0 or a 1
to the relevant bit in the register.

So, on Port A we have 5 pins, and hence 5 bits. If I wanted to set
one of the pins to input, I send a ‘1’ to the relevant bit. If I wanted to
set one of the pins to an output, I set the relevant bit to ‘0’. The bits
are arranges in exactly the same way as the pins, in other words bit
0 is RA0, bit 1 is RA1, bit 2 is RA2 and so on.

        PORT A Pin    RA4     RA3       RA2       RA1        RA0
        Bit Number     4        3         2         1         0
           Binary      0        0         1         1         0
THE REGISTERS
W ( working register )

The W register is a general register in which you can put any
value that you wish. Once you have assigned a value to W, you
can add it to another value, or move it. If you assign another
value to W, its contents are overwritten.
THE REGISTERS

Now what he have to do is turn an LED on. We do this by
making one of the pins (the one with the LED connected to it)
high. In other words, we send a ‘1’ to the pin.

movlw          02h
movwf          05h

So, now our LED is on, we now need to turn it off:

movlw          00h
movwf          05h
REGISTER ADDRESSING MODES




Direct Addressing:
Uses 7 bits of 14 bit instruction to identify a register file address 8th
and 9th bit comes from RP0 and RP1 bits of STATUS register.
PIC PERIPHERALS

The PIC microcontroller has many built
in peripherals and this can make using them
quite daunting at first which is why I have made
this introductory page with a summary of each
major peripheral block.
PIC PERIPHERALS

      PIC microcontroller     PIC microcontroller
           Feature            feature description
        Flash memory           Re-programmable
                               program storage.
             RAM              Memory storage for
                                 variables.
           EEPROM           Long term stable memory
                              : Electrically Erasable
                               Programmable Read
                                   Only Memory.
           I/O ports        High current Input/output
                                 ports (with pin
                               direction change).
           USART             Built in RS232 protocol
                                (only needs level
                                 translator chip).
PIC PERIPHERALS

Flash memory
This is the program storage area and gives you the most
important benefit for using a PIC microcontroller - You program
the device many times.


 PIC microcontroller RAM
 The PIC microcontroller RAM size is also important as it stores
 all your variables and intermediate data.

 Note: You can usually alter the program to use less RAM by
 choosing the right variable sizes or changing how your program
 works

 For example don't use floating point alter it to use a different
 variable type e.g. you can use long integers with fixed point
 operation to avoid floating point.
PIC PERIPHERALS

PIC microcontroller EEROM

Electrically Erasable ROM is used to store data that must be
saved between power up and power down.

This area is readable and writable and has a much longer life
than the main program store i.e. it has been designed for more
frequent use.
PIC PERIPHERALS

I/O Ports
Input / Output ports let you communicate with the outside world so
you can control leds, LCDs or just about anything with the right
interface. You can also set them as inputs to gather information.

Pin direction
Most PIC microcontroller pins can be set as an input or and output
and this can be done on the fly e.g. for a dallas 1 wire system a pin
can be written to generate data and read at a later stage. The TRIS
register controls the I/O direction and setting a bit in this register
to zero sets the pin as output while setting it as one sets the pin
as input.
Thanks for Attendance

Más contenido relacionado

La actualidad más candente

Microprocessor and microcontrollers
Microprocessor and microcontrollersMicroprocessor and microcontrollers
Microprocessor and microcontrollersHiran Gabriel
 
AVR Microcontroller
AVR MicrocontrollerAVR Microcontroller
AVR MicrocontrollerÖzcan Acar
 
Introduction to Processor Design and ARM Processor
Introduction to Processor Design and ARM ProcessorIntroduction to Processor Design and ARM Processor
Introduction to Processor Design and ARM ProcessorDarling Jemima
 
Introduction to ARM LPC2148
Introduction to ARM LPC2148Introduction to ARM LPC2148
Introduction to ARM LPC2148Veera Kumar
 
Introduction to pic microcontroller
Introduction to pic microcontrollerIntroduction to pic microcontroller
Introduction to pic microcontrollerSiva Kumar
 
8051 Microcontroller ppt
8051 Microcontroller ppt8051 Microcontroller ppt
8051 Microcontroller pptRahul Kumar
 
INTRODUCTION TO MICROCONTROLLER
INTRODUCTION TO MICROCONTROLLERINTRODUCTION TO MICROCONTROLLER
INTRODUCTION TO MICROCONTROLLERAnkita Jaiswal
 
I2c protocol - Inter–Integrated Circuit Communication Protocol
I2c protocol - Inter–Integrated Circuit Communication ProtocolI2c protocol - Inter–Integrated Circuit Communication Protocol
I2c protocol - Inter–Integrated Circuit Communication ProtocolAnkur Soni
 
Introduction to 8085 Microprocessor
Introduction to 8085 MicroprocessorIntroduction to 8085 Microprocessor
Introduction to 8085 MicroprocessorRavi Anand
 
Hardware interfacing basics using AVR
Hardware interfacing basics using AVRHardware interfacing basics using AVR
Hardware interfacing basics using AVRMohamed Abdallah
 
Introduction to Arduino Hardware and Programming
Introduction to Arduino Hardware and ProgrammingIntroduction to Arduino Hardware and Programming
Introduction to Arduino Hardware and ProgrammingEmmanuel Obot
 

La actualidad más candente (20)

Microprocessor and microcontrollers
Microprocessor and microcontrollersMicroprocessor and microcontrollers
Microprocessor and microcontrollers
 
AVR Microcontroller
AVR MicrocontrollerAVR Microcontroller
AVR Microcontroller
 
Introduction to Processor Design and ARM Processor
Introduction to Processor Design and ARM ProcessorIntroduction to Processor Design and ARM Processor
Introduction to Processor Design and ARM Processor
 
Introduction to ARM LPC2148
Introduction to ARM LPC2148Introduction to ARM LPC2148
Introduction to ARM LPC2148
 
Microcontroller
MicrocontrollerMicrocontroller
Microcontroller
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
8255 presentaion.ppt
8255 presentaion.ppt8255 presentaion.ppt
8255 presentaion.ppt
 
8086
80868086
8086
 
I/O Ports
I/O Ports I/O Ports
I/O Ports
 
Timers
TimersTimers
Timers
 
Introduction to pic microcontroller
Introduction to pic microcontrollerIntroduction to pic microcontroller
Introduction to pic microcontroller
 
8051 Microcontroller ppt
8051 Microcontroller ppt8051 Microcontroller ppt
8051 Microcontroller ppt
 
Microcontroller
MicrocontrollerMicrocontroller
Microcontroller
 
INTRODUCTION TO MICROCONTROLLER
INTRODUCTION TO MICROCONTROLLERINTRODUCTION TO MICROCONTROLLER
INTRODUCTION TO MICROCONTROLLER
 
I2c protocol - Inter–Integrated Circuit Communication Protocol
I2c protocol - Inter–Integrated Circuit Communication ProtocolI2c protocol - Inter–Integrated Circuit Communication Protocol
I2c protocol - Inter–Integrated Circuit Communication Protocol
 
PIC Microcontrollers
PIC MicrocontrollersPIC Microcontrollers
PIC Microcontrollers
 
Introduction to 8085 Microprocessor
Introduction to 8085 MicroprocessorIntroduction to 8085 Microprocessor
Introduction to 8085 Microprocessor
 
Hardware interfacing basics using AVR
Hardware interfacing basics using AVRHardware interfacing basics using AVR
Hardware interfacing basics using AVR
 
Introduction to Arduino Hardware and Programming
Introduction to Arduino Hardware and ProgrammingIntroduction to Arduino Hardware and Programming
Introduction to Arduino Hardware and Programming
 
8086 Microprocessor
8086 Microprocessor8086 Microprocessor
8086 Microprocessor
 

Destacado

Programming with PIC microcontroller
Programming with PIC microcontroller Programming with PIC microcontroller
Programming with PIC microcontroller Raghav Shetty
 
PIC-MICROCONTROLLER TUTORIALS FOR BEGINNERS
PIC-MICROCONTROLLER TUTORIALS FOR BEGINNERSPIC-MICROCONTROLLER TUTORIALS FOR BEGINNERS
PIC-MICROCONTROLLER TUTORIALS FOR BEGINNERSVISHNU KP
 
Pic microcontroller [autosaved] [autosaved]
Pic microcontroller [autosaved] [autosaved]Pic microcontroller [autosaved] [autosaved]
Pic microcontroller [autosaved] [autosaved]gauravholani
 
M1 lte e nodeb integration work flow v1.8 19oct2011
M1 lte e nodeb integration work flow v1.8 19oct2011M1 lte e nodeb integration work flow v1.8 19oct2011
M1 lte e nodeb integration work flow v1.8 19oct2011Emilson Cruz
 
Vi dieukhien pic
Vi dieukhien picVi dieukhien pic
Vi dieukhien picmisuki_taro
 
Gambar aktiviti assignment koku belinda
Gambar aktiviti assignment koku belindaGambar aktiviti assignment koku belinda
Gambar aktiviti assignment koku belindaBelinda Panjang
 
Project list pic microcontroller 877- projects
Project list   pic microcontroller  877- projectsProject list   pic microcontroller  877- projects
Project list pic microcontroller 877- projectsAshraf11111
 
PIC microcontroller review
PIC microcontroller reviewPIC microcontroller review
PIC microcontroller reviewMohsen Sarakbi
 
Wireless RF Module Using PIC MCU (Slides).
Wireless RF Module Using PIC MCU (Slides).Wireless RF Module Using PIC MCU (Slides).
Wireless RF Module Using PIC MCU (Slides).Abee Sharma
 
Ling on PIC32 microcontroller
Ling on PIC32 microcontrollerLing on PIC32 microcontroller
Ling on PIC32 microcontrollerViktor Sovietov
 
Voice controlled spy robot for security system
Voice controlled spy robot for security systemVoice controlled spy robot for security system
Voice controlled spy robot for security systemMayank Prajapati
 
8-bit PIC Microcontrollers
8-bit PIC Microcontrollers8-bit PIC Microcontrollers
8-bit PIC MicrocontrollersPremier Farnell
 
Microchip's PIC Micro Controller
Microchip's PIC Micro ControllerMicrochip's PIC Micro Controller
Microchip's PIC Micro ControllerMidhu S V Unnithan
 
[ PPT ] NS _ppt 4..ppt microprocesser and microcontroller fundamentals
[ PPT ] NS _ppt 4..ppt microprocesser and microcontroller fundamentals [ PPT ] NS _ppt 4..ppt microprocesser and microcontroller fundamentals
[ PPT ] NS _ppt 4..ppt microprocesser and microcontroller fundamentals naresh1992
 
Pic18 f4520 and robotics
Pic18 f4520 and roboticsPic18 f4520 and robotics
Pic18 f4520 and roboticsSiddhant Chopra
 

Destacado (20)

Programming with PIC microcontroller
Programming with PIC microcontroller Programming with PIC microcontroller
Programming with PIC microcontroller
 
PIC-MICROCONTROLLER TUTORIALS FOR BEGINNERS
PIC-MICROCONTROLLER TUTORIALS FOR BEGINNERSPIC-MICROCONTROLLER TUTORIALS FOR BEGINNERS
PIC-MICROCONTROLLER TUTORIALS FOR BEGINNERS
 
Pic microcontroller [autosaved] [autosaved]
Pic microcontroller [autosaved] [autosaved]Pic microcontroller [autosaved] [autosaved]
Pic microcontroller [autosaved] [autosaved]
 
M1 lte e nodeb integration work flow v1.8 19oct2011
M1 lte e nodeb integration work flow v1.8 19oct2011M1 lte e nodeb integration work flow v1.8 19oct2011
M1 lte e nodeb integration work flow v1.8 19oct2011
 
Chapter5 dek3133
Chapter5 dek3133Chapter5 dek3133
Chapter5 dek3133
 
16f84
16f8416f84
16f84
 
Vi dieukhien pic
Vi dieukhien picVi dieukhien pic
Vi dieukhien pic
 
Data Sheet PIC 16F84
Data Sheet PIC 16F84Data Sheet PIC 16F84
Data Sheet PIC 16F84
 
Gambar aktiviti assignment koku belinda
Gambar aktiviti assignment koku belindaGambar aktiviti assignment koku belinda
Gambar aktiviti assignment koku belinda
 
Project list pic microcontroller 877- projects
Project list   pic microcontroller  877- projectsProject list   pic microcontroller  877- projects
Project list pic microcontroller 877- projects
 
PIC microcontroller review
PIC microcontroller reviewPIC microcontroller review
PIC microcontroller review
 
Wireless RF Module Using PIC MCU (Slides).
Wireless RF Module Using PIC MCU (Slides).Wireless RF Module Using PIC MCU (Slides).
Wireless RF Module Using PIC MCU (Slides).
 
Ling on PIC32 microcontroller
Ling on PIC32 microcontrollerLing on PIC32 microcontroller
Ling on PIC32 microcontroller
 
Voice controlled spy robot for security system
Voice controlled spy robot for security systemVoice controlled spy robot for security system
Voice controlled spy robot for security system
 
Ppt
PptPpt
Ppt
 
Pic microcontroller step by step your complete guide
Pic microcontroller step by step your complete guidePic microcontroller step by step your complete guide
Pic microcontroller step by step your complete guide
 
8-bit PIC Microcontrollers
8-bit PIC Microcontrollers8-bit PIC Microcontrollers
8-bit PIC Microcontrollers
 
Microchip's PIC Micro Controller
Microchip's PIC Micro ControllerMicrochip's PIC Micro Controller
Microchip's PIC Micro Controller
 
[ PPT ] NS _ppt 4..ppt microprocesser and microcontroller fundamentals
[ PPT ] NS _ppt 4..ppt microprocesser and microcontroller fundamentals [ PPT ] NS _ppt 4..ppt microprocesser and microcontroller fundamentals
[ PPT ] NS _ppt 4..ppt microprocesser and microcontroller fundamentals
 
Pic18 f4520 and robotics
Pic18 f4520 and roboticsPic18 f4520 and robotics
Pic18 f4520 and robotics
 

Similar a PIC introduction + mapping

Similar a PIC introduction + mapping (20)

Introduction2_PIC.ppt
Introduction2_PIC.pptIntroduction2_PIC.ppt
Introduction2_PIC.ppt
 
My seminar new 28
My seminar new 28My seminar new 28
My seminar new 28
 
Microcontroller
MicrocontrollerMicrocontroller
Microcontroller
 
AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080
AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080
AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080
 
Presentation
PresentationPresentation
Presentation
 
Introduction to PIC.pptx
Introduction to PIC.pptxIntroduction to PIC.pptx
Introduction to PIC.pptx
 
Basics Of Embedded Systems
Basics Of Embedded SystemsBasics Of Embedded Systems
Basics Of Embedded Systems
 
PIC Presentation_final updated.pptx
PIC Presentation_final updated.pptxPIC Presentation_final updated.pptx
PIC Presentation_final updated.pptx
 
EE6008 MCBSD - Introduction to PIC Micro controller
EE6008 MCBSD - Introduction to PIC Micro controller EE6008 MCBSD - Introduction to PIC Micro controller
EE6008 MCBSD - Introduction to PIC Micro controller
 
EE6008 MBSD
EE6008  MBSDEE6008  MBSD
EE6008 MBSD
 
Ee6008 mcbsd notes
Ee6008 mcbsd notesEe6008 mcbsd notes
Ee6008 mcbsd notes
 
digital clock atmega16
digital clock atmega16digital clock atmega16
digital clock atmega16
 
8051 Presentation
8051 Presentation8051 Presentation
8051 Presentation
 
Atmega16
Atmega16Atmega16
Atmega16
 
Avr microcontroller
Avr microcontrollerAvr microcontroller
Avr microcontroller
 
5. Features of the LPC214X Family.pptx
5. Features of the LPC214X Family.pptx5. Features of the LPC214X Family.pptx
5. Features of the LPC214X Family.pptx
 
8051 presentation
8051 presentation8051 presentation
8051 presentation
 
EMBEDDED SYSTEMS AND IOT lab manual for enginnering students
EMBEDDED SYSTEMS AND IOT lab manual for enginnering studentsEMBEDDED SYSTEMS AND IOT lab manual for enginnering students
EMBEDDED SYSTEMS AND IOT lab manual for enginnering students
 
Introduction to microprocessor
Introduction to microprocessorIntroduction to microprocessor
Introduction to microprocessor
 
pic_1.pdf
pic_1.pdfpic_1.pdf
pic_1.pdf
 

Último

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 

Último (20)

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 

PIC introduction + mapping

  • 1. PIC MICROCONTROLLER By : Osama Hasan
  • 2. AN INTRODUCTION TO PIC MICROCONTROLLERS - The name PIC was originally an acronym for "Programmable Intelligent Computer". - A PIC microcontroller is a processor with built in memory and RAM and you can use it to control your projects. - What this really means for you is that you have a very powerful device that has many useful built in modules e.g. * EEPROM. * Timers. * Analogue comparators. * UART.
  • 3. INTRODUCTION (CONT.) Why PIC is popular?  low cost ,wide availability with high clock speed  availability of low cost or free development tools  Only 37 instructions to remember  serial programming and re-programming with flash memory capability  Its code is extremely efficient, allowing the PIC to run with typically less program memory than its larger competitors  PIC is very small and easy to implement for non- complex problems and usually accompanies to the microprocessors as an interface
  • 4. TWO DIFFERENT ARCHITECTURES  Harvard Architectures  Von-Neumann (newer arch.) Architecture
  • 5. TWO DIFFERENT ARCHITECTURES  Harvard Architectures  Von-Neumann Architecture  Used mostly in RISC CPUs  Used in: 80X86 (CISC PCs)  Separate program bus and data bus: can be of different widths  Only one bus between CPU and memory  For example, PICs use:  RAM and program memory  Data memory (RAM): a small share the same bus and the number of 8bit registers same memory, and so must have  Program memory (ROM): the same bit width. 12bit, 14bit or 16bit wide (in EPROM, FLASH, or ROM)
  • 6. RISC VS. CISC Complex Instruction Set Computer (CISC) Is a computer where single instructions can execute several low-level operations (such as a load from memory, an arithmetic operation, and a memory store) and/or are capable of multi-step operations or addressing modes within single instructions.  Used in: 80X86, 8051, 68HC11, etc.  Many instructions (usually > 100)  Several addressing modes  Usually takes more than 1 internal clock cycle (Tcyc) to execute
  • 7. RISC VS. CISC Reduced Instruction Set Computer (RISC) Is a CPU design strategy based on the insight that simplified instructions can provide higher performance if this simplicity enables much faster execution of each instruction. A computer based on this strategy is a reduced instruction set computer also called 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)
  • 8. FAMILY CORE ARCHITECTURE DIFFERENCES  The PIC Family: Cores  12bit cores with 33 instructions: 12C50x, 16C5x  14bit cores with 35 instructions: 12C67x,16Cxxx  16bit cores with 58 instructions: 17C4x,17C7xx  ‘Enhanced’ 16bit cores with 77 instructions: 18Cxxx
  • 9. THE PIC FAMILY: SPEED  Can use crystals, clock oscillators, or even an RC circuit.  Some PICs have a built in 4MHz RC clock, Not very accurate, but requires no external components!  Instruction speed = 1/4 clock speed (Tcyc = 4 * Tclk)  All PICs can be run from DC to their maximum specified speed: 12C50x 4MHz 12C67x 10MHz 16Cxxx 20MHz 17C4x / 17C7xxx 33MHz 18Cxxx 40MHz
  • 10. CLOCK AND INSTRUCTION CYCLES  Instruction Clock  Clock from the oscillator enters a microcontroller via OSC1 pin where internal circuit of a microcontroller divides the clock into four even clocks Q1, Q2, Q3, and Q4 which do not overlap.  These four clocks make up one instruction cycle (also called machine cycle) during which one instruction is executed.  Execution of instruction starts by calling an instruction that is next in string.  Instruction is called from program memory on every Q1 and is written in instruction register on Q4.  Decoding and execution of instruction are done between the next Q1 and Q4 cycles. On the following diagram we can see the relationship between instruction cycle and clock of the oscillator (OSC1) as well as that of internal clocks Q1-Q4.  Program counter (PC) holds information about the address of the next instruction.
  • 11. CLOCK AND INSTRUCTION CYCLES (CONT.)
  • 13. THE PIC FAMILY: PROGRAM MEMORY  Technology: EPROM, FLASH, or ROM  It varies in size from one chip to another. - examples: 12C508 512 12bit instructions 16C711 1024 (1k) 14bit instructions 16F877 8192 (8k) 14bit instructions 17C766 16384 (16k) 16bit instructions
  • 14. MICROCHIP PIC 16F84 MICROCONTROLLER High Performance RISC CPU: Only 35 single word instructions to learn All single cycle instructions except for program branches, which are two-cycle Operating speed: DC - 20 MHz clock input DC - 200 ns instruction cycle
  • 15. MICROCHIP PIC 16F84 MICROCONTROLLER Below is a diagram showing the pin-outs of the PIC 16F84. We will go through each pin, explaining what each is used for.
  • 16. MICROCHIP PIC 16F84 MICROCONTROLLER RA0 To RA4 RA is a bidirectional port. That is, it can be configured as an input or an output. The number following RA is the bit number (0 to 4). So, we have one 5-bit directional port where each bit can be configured as Input or Output. RB0 To RB7 RB is a second bidirectional port. It behaves in exactly the same way as RA, except there are 8 - bits involved.
  • 17. MICROCHIP PIC 16F84 MICROCONTROLLER VSS And VDD These are the power supply pins. VDD is the positive supply, and VSS is the negative supply, or 0V. The maximum supply voltage that you can use is 6V, and the minimum is 2V. OSC1/CLK IN And OSC2/CLKOUT These pins is where we connect an external clock, so that the microcontroller has some kind of timing.
  • 18. MICROCHIP PIC 16F84 MICROCONTROLLER MCLR This pin is used to erase the memory locations inside the PIC (i.e. when we want to re-program it. In normal use it is connected to the positive supply rail. T0CK1 This is another clock input, which operates an internal timer. It operates in isolation to the main clock.
  • 19. MICROCHIP PIC 16F84 MICROCONTROLLER Below is a diagram showing the pin-outs of the PIC 16F84. We will go through each pin, explaining what each is used for. PORT A PORT B
  • 20. PIC DATA MEMORY The most important registers have addresses in all the four banks The data memory is devided into 4 memory banks
  • 21. THE REGISTERS A register is a place inside the PIC that can be written to, read from or both. you will notice is that it is split into two - Bank 0 and Bank 1. Bank 1 is used to control the actual operation of the PIC, for example to tell the PIC which bits of Port A are input and which are output. Bank 0 is used to manipulate the data. An example is as follows: Let us say we want to make one bit on Port A high. First we need to go to Bank 1 to set the particular bit, or pin, on Port A as an output. We then come back to Bank 0 and send a logic 1 (bit 1) to that pin.
  • 22.
  • 23. THE REGISTERS The most common registers in Bank 1 we are going to use are STATUS, TRISA and TRISB. The first allows us to come back to Bank 0, TRISA allows us to select which pins on Port A are output and which are input, TRISB allows us to select which pins on Port B are output and which are input. The SELECT register in Bank 0 allows us to switch to Bank 1. STATUS To change from Bank 0 to Bank 1 we tell the STAUS register. We do this by setting bit 5 of the STATUS register to 1. To switch back to Bank 0, we set bit 5 of the STATUS register to 0. The STATUS register is located at address 03h.
  • 24. THE REGISTERS TRISA and TRISB. These are located at addresses 85h and 86h respectively. To program a pin to be an output or an input, we simply send a 0 or a 1 to the relevant bit in the register. So, on Port A we have 5 pins, and hence 5 bits. If I wanted to set one of the pins to input, I send a ‘1’ to the relevant bit. If I wanted to set one of the pins to an output, I set the relevant bit to ‘0’. The bits are arranges in exactly the same way as the pins, in other words bit 0 is RA0, bit 1 is RA1, bit 2 is RA2 and so on. PORT A Pin RA4 RA3 RA2 RA1 RA0 Bit Number 4 3 2 1 0 Binary 0 0 1 1 0
  • 25. THE REGISTERS W ( working register ) The W register is a general register in which you can put any value that you wish. Once you have assigned a value to W, you can add it to another value, or move it. If you assign another value to W, its contents are overwritten.
  • 26.
  • 27. THE REGISTERS Now what he have to do is turn an LED on. We do this by making one of the pins (the one with the LED connected to it) high. In other words, we send a ‘1’ to the pin. movlw 02h movwf 05h So, now our LED is on, we now need to turn it off: movlw 00h movwf 05h
  • 28. REGISTER ADDRESSING MODES Direct Addressing: Uses 7 bits of 14 bit instruction to identify a register file address 8th and 9th bit comes from RP0 and RP1 bits of STATUS register.
  • 29. PIC PERIPHERALS The PIC microcontroller has many built in peripherals and this can make using them quite daunting at first which is why I have made this introductory page with a summary of each major peripheral block.
  • 30. PIC PERIPHERALS PIC microcontroller PIC microcontroller Feature feature description Flash memory Re-programmable program storage. RAM Memory storage for variables. EEPROM Long term stable memory : Electrically Erasable Programmable Read Only Memory. I/O ports High current Input/output ports (with pin direction change). USART Built in RS232 protocol (only needs level translator chip).
  • 31. PIC PERIPHERALS Flash memory This is the program storage area and gives you the most important benefit for using a PIC microcontroller - You program the device many times. PIC microcontroller RAM The PIC microcontroller RAM size is also important as it stores all your variables and intermediate data. Note: You can usually alter the program to use less RAM by choosing the right variable sizes or changing how your program works For example don't use floating point alter it to use a different variable type e.g. you can use long integers with fixed point operation to avoid floating point.
  • 32. PIC PERIPHERALS PIC microcontroller EEROM Electrically Erasable ROM is used to store data that must be saved between power up and power down. This area is readable and writable and has a much longer life than the main program store i.e. it has been designed for more frequent use.
  • 33. PIC PERIPHERALS I/O Ports Input / Output ports let you communicate with the outside world so you can control leds, LCDs or just about anything with the right interface. You can also set them as inputs to gather information. Pin direction Most PIC microcontroller pins can be set as an input or and output and this can be done on the fly e.g. for a dallas 1 wire system a pin can be written to generate data and read at a later stage. The TRIS register controls the I/O direction and setting a bit in this register to zero sets the pin as output while setting it as one sets the pin as input.