PIC Microcontroller

PIC microcontrollers are manufactured by Microchip

They cover a huge range of devices, from tiny 8-bit microcontrollers to 32-bit advanced PIC32 devices. All PIC microcontrollers use Harvard architecture, which means that they have separate buses for data and instructions. If a device is called an 8-bit microcontroller, this means that its data bus is 8-bit, a 16-bit device has a 16-bit data bus and, guess what, a 32-bit microcontroller has an 32-bit data bus.

Later PIC families have a 16-bit data bus, which include PIC24 and dsPIC series so these are 16-bit microcontrollers but they have a 24-bit instruction bus, hence the PIC24 name. PIC32 series have 32-bit data bus.

The instruction bus is always bigger, and different 8-bit PIC families have various sizes of instruction. The bigger the instruction bus, the bigger the memory that can be accessed with each instruction, as part of the instruction can include an address.

  • Baseline PIC devices have 12-bit instruction bus and include all PIC10, PIC12F5x and PIC16F5x microcontrollers
  • Mid range devices have 14-bit bus, most PIC12F and PIC16F series
  • High end core has 16-bit instructions, these are PIC18 series

The F means that devices have flash memory, so they can be reprogrammed lots of times, including in circuit. Older C devices are OTP, One Time Programmable, except PIC16C84 that has EEPROM so can be reprogrammed. In this day and age, avoid using C devices unless you are using millions of them!

All 8-bit PIC microcontrollers have a reduced instruction set (RISC). This makes execution much faster than earlier microcontrollers such as 8051 and this coupled with lower cost made the PIC so successful. The baseline PIC devices only have 35 different instructions but this has increased to 80 in the later high end core, mainly to accommodate the needs of efficient C compilers.

Apart from the core, all PIC devices have a range of peripherals built-in. These include timers, communication channels like UART, I2C and SPI plus ADC, Analog comparators and PWM for analog work. They also come with different amounts of I/O pins:

  • Baseline from 6-pin to 40-pin
  • Mid range from 8-40 pin
  • High end (PIC18F) from 18-100 pin

Available program memory also varies with the different families:

  • Baseline up to 3KB
  • Mid range up to 14KB (28KB for some enhanced PIC16F)
  • PIC18F up to 128KB

There are hundreds of different PIC microcontrollers available, so where do you start if you are a beginner? If you have a particular project in mind, the main factor is the pin count, which is harder to alter later. Versions with more memory have the same pin layout as smaller memory devices, so it is easier to upgrade to more memory later if you need to. This is one of the better features of the PIC family, consistent pin layout.

If you want to learn PIC microcontroller programming from scratch, we suggest that the mid-range PIC16F series is the place to start, in particular the PIC16F887. This is the replacement for the popular PIC16F877 but is half the price. The web is littered with code examples for this device, it is 40-pin and has 14KB of program memory, making it a flexible first choice.

As well as the code memory, it has 256 bytes of EEPROM memory for storing data such as serial numbers, or configuration parameters. Its instruction set is pretty good and free C compilers produce reasonable code,although we believe that you should start in assembler so that you develop more understanding of the structure and how microcontrollers work.

Once you have learnt to code for a PIC16F microcontroller, then you can upgrade to PIC18F series if you need more memory, more pins or faster speed. Kanda have a PIC training kit that starts with PIC16F887 and then moves on to PIC18F, using both assembly code and C programming, and it includes a book to get you going.


5 thoughts on “PIC Microcontroller”

  1. This web site is really a walk-through for all of the info you wanted about this and didn’t know who to ask. Glimpse here, and you’ll definitely discover it.

  2. I just want to tell you that I am newbie to weblog and actually enjoyed you’re blog. Most likely I’m going to bookmark your site . You surely have perfect well written articles. Regards for sharing with us your website.

  3. Whats up this is kind of of off topic but I was wanting to know if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding experience so I wanted to get guidance from someone with experience. Any help would be enormously appreciated!

    1. WordPress based blogs are WYSIWYG, with buttons for inserting lists, links, bold text etc so you don’t need to enter any HTML.

  4. I blog quite often and I genuinely thank you for your content.rnrnYour article has really peaked my interest.rnI am going to book mark your blog and keep checking for new details about once a rnweek. I subscribed to your RSS feed too.

Leave a Reply

Your email address will not be published. Required fields are marked *