Advertisement
pic microcontroller tutorial

PIC Microcontroller Primer – Tutorial #1

pic microcontroller tutorial Welcome to the starting line of the PIC Microcontroller Primer. Microchip manufacture a series of microcontrollers called PIC, and this tutorial series will take you from the basic structure of PIC µCs right through to the programming methods and techniques.

Note that there are many different PIC µC packages are now available, from some basic low memory types to ones that have analogue to digital converters (ADC) and even pulse width modulator (PWM) blocks built in. At first, I am going to focus on the emblematic PIC12F675 µC. Once you have learnt how to program one type of PIC µC, learning the rest is sweet and simple!

PIC 12F675 microcontroller

PIC 12F675 is an 8-Pin, Flash-Based 8-Bit, PIC ® Mid-Range CMOS µC, comes in 8-pin PDIP, SOIC, MLF-S and DFN packages. One advantage of PIC12F675 when compared to its predecessor PIC 12F629 is that 12F675 has an inbuilt 10-bit ADC. In short, the feature-packed 12F675 has 1024 words of program memory, 64 Bytes of RAM and 128 Bytes of EEPROM, an internal oscillator, timers, an ADC and a comparator. Since this tutorial part contains basic device specific information for the PIC12F675, additional information may be collected from the datasheet published by Microchip.

PIC 12F675 Mini Development Board

As a part of learning, it is recommended to build your own PIC12F675 mini development board. The circuit shown here is easy enough to make a development board yourself. For hardware all we need is a standard piece of perforated prototyping board, ic socket, headers with a 0.1 inch (2.54 mm) pitch, and a handful of discrete components in addition to the fixed voltage regulator chip and the PIC12F675 microcontroller. The components of the development board can be mounted on the top side of the prototyping board (as usual) and soldered on its underside. Then attach the headers to the prototyping board with solder joints on its underside. Remember to leave a little gap between the underside of the prototyping board and the plastic carrier of the headers to allow for soldering there later. Ordinary wire can be used to connect between the components and the header pins. The development board can be powered from any 9-12 V standard dc power supply source.

headers on the prototyping board

(headers on the prototyping board – an example)

Here is the circuit diagram of the mini development board. The ICSP header in the board allows you to program the PIC 12F675 microcontroller using an ICSP programmer (will discuss later).

pic development board circuit

PIC USB Programmer

Microchip’s PICKit2 is a USB based ICSP (In Circuit Serial Programming) programmer. This programmer is preferred here because it is much more comfortable, reliable and powerful than any other programmer we can find all over the internet world.

Well, next is a simple programming tutorial on the PIC 12F675 microcontroller which shows you how to program and use it as a simple LED flasher.

Part 2

25 Comments

Join the conversation!

Error! Please fill all fields.
  • RICKY

    DEAR SIR: I AM LEARNING SOMETHING NEW. THANKS FOR SHARING WHAT YOU KNOW, WELL APPRECIATED.

    • tkhareendran

      @Ricky: Thanks! I regret, the submission schedule of this tutorial has been interrupted because of some technical issues from my side. Sure, the tutorial will restart within this month.

  • Eric-Jan van den Bogaard

    Just found a Pickit2 starterkit at a local shop, now i have 2 programmers 🙂 the Pickit2 wil generate all needed voltages ?

  • T.K.Hareendran

    @N3XVS: As you rightly noticed, PIC Kit 3 is latest,and packed with more features(PicKit3 is a little more advanced, and likely to be supported for longer). In my lab I am still using PIC Kit 2, that’s why the tutorial is prepared on this basis. However, I will add all updates in the concluding part of this tutorial.

    Meanwhile, you can refer this link to know more about PIC Kit-s (a great video review by Dave Jones): http://www.eevblog.com/2009/10/21/eevblog-39-pickit-3-programmerdebugger-review/

    Thanks for your feedback and suggestions!

  • N3XVS

    Thank you for this very interesting tutorial. But I would like to know if it is ok to use PIC Kit 3 instead of the PIC Kit 2. Because this is the most commonly available debugger in the market today, and even Microchip has recommended this new version. Will there be any difference, e.g. programming, usage, etc., from that of PIC Kit 2, and with your tutorial here?

  • walter pajares

    quisiera saber si con esta programación de pic puedo hacer frecuencimetros para transmisores de radio y colocarlos para cambiar la frecuencia del transmisor?

  • Eric Jan

    .bas Proton basic would also be nice for affordable software…

    • T.K.Hareendran

      Yes, will try to include .bas (Proton Basic) tutorials/codes in the forthcoming parts…

  • padmanabhan krishnan

    Dear sir,
    Great start in PIC! Pl give the listing details of the code in .asm, this will help lot of folks who use assembly language.

    Regards.
    padmanabhan.k

    • T.K.Hareendran

      Thanks…

      Your suggestions noted with great pleasure…

      Really inspired by your valuable feedback!

  • Dominic

    I salute your service.
    Waiting for more lessons.
    Excellent work

    Hats off.

    Dominic

  • garrionH

    How and when is part 2 available please

    • T.K.Hareendran

      @Garrion: As soon as possible. In all probability within 1 week. Thanks for your keen interest…

  • Eric Jan

    Is “brownout” important ? I see this sometimes at the start of a basic script, but if i load a .hex the brownout is already set ?

Looking for the latest from TI?