pic overview elg4911 l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
PIC Overview ELG4911 PowerPoint Presentation
Download Presentation
PIC Overview ELG4911

Loading in 2 Seconds...

play fullscreen
1 / 20

PIC Overview ELG4911 - PowerPoint PPT Presentation


  • 421 Views
  • Uploaded on

PIC Overview ELG4911 Raymond Peterkin Edited by: Misbah Islam Outline Introduction to PIC Developing code for PIC MPLAB IDE Project Creation Updating Source Code Building Projects Programming the PIC References: www.microchip.com

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'PIC Overview ELG4911' - niveditha


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
pic overview elg4911

PIC Overview ELG4911

Raymond Peterkin

Edited by: Misbah Islam

outline
Outline
  • Introduction to PIC
  • Developing code for PIC
    • MPLAB IDE
    • Project Creation
    • Updating Source Code
    • Building Projects
  • Programming the PIC
      • References: www.microchip.com
introduction to pic peripheral interconnect microcontrollers
Introduction to PIC: Peripheral Interconnect Microcontrollers

Basically meant to develop and run ASM programs

More than One billion 8bit processors have been sold

  • 8 Bit Family PIC10, PIC12, PIC14, PIC16, PIC 18
    • < $20 , Memory 8K-256 K, 48 MHz, 6-100 Pins

PIC 18 Features:

    • 9-Ports, 80 pins, Parallel I/O, PWM, 10bit ADC, USART, CAN, Timers
    • On chip memory 64KB,

External Off-chip 2 MB (EMI uses 38 pins)

  • 16 Bit family
    • (ASM, C) PIC24, PIC32
asm and c
ASM and C
  • To run C you need cross compilers
  • MPLAB with Lite-C or MCC18 compilers need models PIC18 and over
  • With commercial systems, e.g. CCS and Hi-TECH you can compile C programs on all models
  • http://ww1.microchip.com/downloads/en/DeviceDoc/51025e.pdf (pp.44)

Code Examples:

http://microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1408

http://microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2623

http://ww1.microchip.com/downloads/en/DeviceDoc/51519B.pdf

developing code for pic asm example
Developing Code for PIC, ASM example

MPLAB IDE:

  • Free integrated development environment (IDE) from Microchip to implement code for PICs
  • Latest version 8.0 (recommended), In Lab 7.6
  • IDE and documentation (user guide) can be downloaded from the Microchip website
  • To open MPLAB IDE
    • StartAll ProgramsMicrochipMPLAB IDE v8.00MPLAB IDE
what are these
What are these?
  • IDE: Integrated Development Environment

Software package that lets you assemble, compile, link, export and debug programs.

  • ICE: In Circuit Emulator:

Hardware that allows you to test the developed programs on non-real (emulated) hardware. To test ICE you need IDE

  • Programmer:

Is a piece of hardware, e.g. PICkit 2, PM3 that allow the export of executable .hex files (load) files to the PIC processor’s memory directly. It is driven by the IDE.

mplab ide projects
MPLAB IDE Projects
  • A project must be created for implementation
    • Specify your device
    • Create and edit your files
    • Compile and link your project
    • Program the device
  • To create a project
    • ProjectProject Wizard…
mplab ide project creation 1 4
MPLAB IDE Project Creation (1/4)
  • Begin project and specify device
mplab ide project creation 2 4
MPLAB IDE Project Creation (2/4)
  • Step 2: Select Microchip MPASM Toolsuite
  • Step 3: Create New Project File
mplab ide project creation 3 4
MPLAB IDE Project Creation (3/4)
  • Step 4: Add project files
  • ASM file
    • Starting point for assembly code
    • <device name>tmpo.asm
  • Linker script
    • <device name>.lkr
  • Example: Device PIC16F917
  • C:\Program Files\Microchip\MPASM Suite\Template\Object\16f917tmpo.asm
      • C:\Program Files\Microchip\MPASM Suite\16f917.lkr
mplab ide project creation 4 4
MPLAB IDE Project Creation (4/4)
  • Finish project creation and return to IDE
  • View project details
    • ViewProject
updating source code
Updating Source Code
  • Modify .asm files
    • Under ‘Source Files’ folder in project window
    • Open and edit files to implement new functionality
    • Additional files can be created and added
building a project
Building a Project
  • ProjectBuild All (or Ctrl+F10)
  • Output window indicates success or failure
  • HEX file generated when project is built
    • Used to program the device
programming the pic directly downloading hex files to the pic memory
Programming the PICDirectly Downloading Hex files to the PIC Memory
  • Used to transfer HEX file to the PIC and begin program execution
  • Two methods (HEX file must be generated)
    • MPLAB IDE
      • ProgrammerSelect ProgrammerPICKit2
    • PICkit2
      • Separate program
      • StartAll ProgramsMicrochipPICkit 2 v2.11
option a programming pic with mplab ide 1 3
Option a.Programming PIC with MPLAB IDE (1/3)
  • Connect PIC to computer through PICkit2 Hardware
  • Select the PICkit 2 from the Programmer menu
    • ProgrammerSelect Programmer PICkit 2
programming pic with mplab ide 2 3
Programming PIC with MPLAB IDE (2/3)
  • New ‘PICkit’ 2 tab appears in the output window
  • New options appear in the Programmer menu and tool bar
programming pic with mplab ide 3 3
Programming PIC with MPLAB IDE (3/3)
  • Transfer HEX file to PIC
    • ProgrammerProgram
option b programming pic with pickit 2 1 2
Option b. Programming PIC with PICkit 2 (1/2)
  • Connect PIC to computer through PICkit2
  • Start PICkit2 programmer software

StartProgramsMicrochipPICkit2 v 2.40

  • Device is listed
  • PIC is detected
programming pic with pickit 2 2 2
Programming PIC with PICkit 2 (2/2)
  • Import HEX file
    • FileImport Hex
  • Transfer HEX file to PIC
    • Click ‘Write’ button
  • Memory contents are updated with new program
references
References
  • Microchip website
    • www.microchip.com
    • Main source of information with several documents
      • MPLAB IDE User’s Guide (under MPLAB IDE description)
        • Chapters 2 and 3 contain tutorials, page 44

http://ww1.microchip.com/downloads/en/DeviceDoc/51025e.pdf

Good Tutorial: p 45 summary

http://ww1.microchip.com/downloads/en/DeviceDoc/51519B.pdf

      • PICkit 2 Microcontroller Programmer User’s Guide
      • PIC data sheets