PIC Overview ELG4911 - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

PIC Overview ELG4911

Description:

Free integrated development environment (IDE) from Microchip to implement code for PICs ... http://ww1.microchip.com/downloads/en/DeviceDoc/51519B.pdf ... – PowerPoint PPT presentation

Number of Views:143
Avg rating:3.0/5.0
Slides: 21
Provided by: danio2
Category:

less

Transcript and Presenter's Notes

Title: PIC Overview ELG4911


1
PIC Overview ELG4911
  • Raymond Peterkin
  • Edited by Misbah Islam

2
Outline
  • Introduction to PIC
  • Developing code for PIC
  • MPLAB IDE
  • Project Creation
  • Updating Source Code
  • Building Projects
  • Programming the PIC
  • References www.microchip.com

3
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
  • lt 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

4
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/51
    025e.pdf (pp.44)
  • Code Examples
  • http//microchip.com/stellent/idcplg?IdcServiceSS
    _GET_PAGEnodeId1408
  • http//microchip.com/stellent/idcplg?IdcServiceSS
    _GET_PAGEnodeId2623
  • http//ww1.microchip.com/downloads/en/DeviceDoc/51
    519B.pdf

5
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

6
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 processors memory directly. It
    is driven by the IDE.

7
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

8
MPLAB IDE Project Creation (1/4)
  • Begin project and specify device

9
MPLAB IDE Project Creation (2/4)
  • Step 2 Select Microchip MPASM Toolsuite
  • Step 3 Create New Project File

10
MPLAB IDE Project Creation (3/4)
  • Step 4 Add project files
  • ASM file
  • Starting point for assembly code
  • ltdevice namegttmpo.asm
  • Linker script
  • ltdevice namegt.lkr
  • Example Device PIC16F917
  • C\Program Files\Microchip\MPASM
    Suite\Template\Object\16f917tmpo.asm
  • C\Program Files\Microchip\MPASM Suite\16f917.lkr

11
MPLAB IDE Project Creation (4/4)
  • Finish project creation and return to IDE
  • View project details
  • View?Project

12
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

13
Building a Project
  • Project?Build All (or CtrlF10)
  • Output window indicates success or failure
  • HEX file generated when project is built
  • Used to program the device

14
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

15
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

16
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

17
Programming PIC with MPLAB IDE (3/3)
  • Transfer HEX file to PIC
  • Programmer?Program

18
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

19
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

20
References
  • Microchip website
  • www.microchip.com
  • Main source of information with several documents
  • MPLAB IDE Users Guide (under MPLAB IDE
    description)
  • Chapters 2 and 3 contain tutorials, page 44
  • http//ww1.microchip.com/downloads/en/DeviceDoc/51
    025e.pdf
  • Good Tutorial p 45 summary
  • http//ww1.microchip.com/downloads/en/DeviceDoc/51
    519B.pdf
  • PICkit 2 Microcontroller Programmer Users Guide
  • PIC data sheets
Write a Comment
User Comments (0)
About PowerShow.com