Warning: mysql_query(): Unable to save result set in /home/efkids/public_html/cake/libs/model/datasources/dbo/dbo_mysql.php on line 411
EFKids - Get Started | PIC Microcontroller FAQ
  Welcome Guest !
PIC Microcontroller FAQs

  1. What is a PIC microcontroller?
  2. What are the different types of PICs available?
  3. What can a PIC and embedded program do?
  4. What do I need to get started?
  5. What are the steps involved in building and testing a simple circuit with PIC?
  6. How do you write a software program for PIC?
  7. How does the programmer work?
  1. What is a PIC microcontroller?
  2. PIC microcontrollers are a series of ICs from Microchip that has at a minimum a built in processor, memory and a flash memory. The chip can be programmed using a set of about 35+ instructions (some variations with certain chips). The program for the chip can be developed using a free software development IDE, MPLAB IDE, provided by Microchip or other free and paid tools available on the web.

  3. What are the different types of PICs available?
  4. PICs come in various flavors and categorized in different forms. Firstly based on register size the PIC can be categorized into a) 8-bit b) 16-bit and c) 32-bit microcontrollers (MCU). As you go up in the registry size the processing speed is faster. For most beginners an 8-bit MCU should be sufficient. Secondly it can be categorized based on family PIC10, PIC12, PIC16 and PIC18 etc. This categorization is based on capabilities or built in features of the IC. Some of the key capabilities include,

    1. Built in timers
    2. Capture-Compare-PWM (CCP)
    3. Voltage Reference Module
    4. Comparator Module
    5. Synchronous Serial Port (SSP)
    6. Analog-to-Digital Converter(A/D)
    7. Universal Asynchronous Receiver Transmitter (UART)
    8. Universal Synchronous Asynchronous Receiver Transmitter(USART)
    9. Serial Peripheral Interface (SPI)
    10. I2C
    11. USB
    Thirdly there are MCUs capable of processing digital signals. These processors start with letters "ds".

  5. What can a PIC and embedded program do?
  6. A PIC supports interfacing with a large number of external circuits and comes built in with a variety of features discussed in the above section. Essentially the speed at which the PIC executes instructions can be controlled using an external or internal clock. The clock can support varying speeds starting from a few KHz to 20 Mhz. The embedded program can be written to read and/or write signals from/to the port pins and can be changed at the desired speed using software logic. The code runs in single thread except for the interrupts. Interrupt is a signal from an interrupt enabled pin or internal clock that stops current execution of the code and execute another set of instruction called "interrupt code". Interrupts are typically used for handling user inputs from switches, key board etc. and also to execute certain operation at a particular time or interval.

  7. What do I need to get started?
    1. A PC running Windows XP or higher.
    2. MPLAB IDE from Microchip, which is software that runs on the PC.
    3. A device programmer to program (burn the compiled program on) PIC microcontrollers (There are number of them available in the market, I recommend PICkit 3 In-Circuit Debugger)
    4. A PIC microcontroller or two e.g. PIC16F84A, PIC16F72, PIC16F628A
    5. A Breadboard to assemble the components.
    6. A reference circuit and components (typically 4 MHz crystal, 27pF ceramic caps, few 470 Ohm resistors and LEDs).

  8. What are the steps involved in building and testing a simple circuit with PIC?
    1. Download and install MPLAB IDE from Microchip web site.
    2. Create a new project in MPLAB IDE and write the code. See details here.
    3. Compile the code to create the .hex file.
    4. Transfer the .hex on to the PIC chip using the programmer tool e.g. (PICkit 3 In-Circuit Debugger). See details here.
    5. Build the circuit on a breadboard using the just burned in chip.
    6. Power up the circuit to see if the program is working.
    7. If the chip is not working the issue could be with the circuit or with the program, so recheck everything again and redo from step 3.
    8. Now you should be having a working PIC controller!!

  9. How do you write a software program for PIC?
  10. There are three programming language options available for writing programs for PIC. We can use assembly, C or picbasic. Depending which language you are comfortable with, you can choose the development environment. Free IDE from Microchip supports both C and assembly language. In this site we will focus more on developing with C and compiler from HI-TECH. These tools are available at the url here. In this site we will be referring to version 8.5x of MPLAB IDE. After installing the product follow the below instructions to create code.

    • First step is to create a project in MPLAB. The easiest way to do that is use the Project Wizard in MPLAB IDE. Select the Project Wizard menu item from the Project pull-down menu as illustrated in Figure below.
    • In the dialog that opens, click Next to move to the chip selection dialog. Select a PIC16F84A device as shown in Figure below then click Next.
    • in the next dialog you specify the toolsuite associated with the project. Here you specify that you will be using the HI-TECH C compilers for Microchip devices. Once the project has been created, you can specify the compiler version that you will use (in case you have installed multiple versions). To use the HI-TECH Family of compilers you must select HI-TECH Universal Toolsuite as the Active Toolsuite in this dialog, as shown in Figure below. Click Next.
    • In this screen select the folder name and type in the project name and click next.
    • Next screen can be ignored for this tutorial. This screen is used for adding any C libraries you have built that you want to reuse.
    • Click Finish and you are ready to code logic for your PIC.
    • In this screen you create new file to add your C code.
    • Type in code as shown in the screen and save the file. Right click on the screen and add the file to the project so that it can be debugged or compiled.
    • Ensure that you have configured your project correctly for the programmer.First select your programmer by clicking on the programmer menu and then do the configuration.
    • Ensure that you have selected the correct crystal frequesncy etc on this screen. These info also can be configured in the code at the top of the main file.
  11. How does the programmer work?
  12. Programmer is a hardware tool used for burning the compiled .hex file into the PIC chip. It uses three pins of IC to burn the program. Some programmer tools also expect that the PIC is externally powered while programming is being done(i.e. VSS and VDD are connected to -ve and +ve terminals). The programmer uses the designated MCLR pin to let the IC know (by taking it to a high voltage e.g. 13V) that it is being programmed. The other two pins varies from PIC to PIC, but will be identified as "Serial programming clock" and "Serial programming data" in the datasheet of the chip. The clock pin is used for sending pulses and the data pin is used for sending .hex data. The programmer typically uses a protocol called In-Circuit Serial Programming(ICSP) for the transfer of .hex data.

Social Likes
Join EFKids Club

text image
* Enter the text above for captcha
Join EFKids Club to get notified when new projects are added.

Electronics For Kids Copyright 2010 - 18 .   EFKids
About EFKids

Warning: Unknown: write failed: No space left on device (28) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0