PIC Microcontroller Overview
PIC microcontrollers are a large family of microcontrollers manufactured by Microchip Technology Inc. The PIC microcontroller family are based on a modified Harvard architecture. They are popular with both industrial developers and hobbyists alike due to their low cost, wide availability, large user base, extensive collection of application notes, availability of low cost or free development tools, and serial programming (and re-programming with flash memory) capability . Like all microcontrollers, they can be used to interface directly with real-world devices such as lights, switches, sensors and motors.
The range of PICs available is gigantic, ranging from tiny 6-pin 8-bit devices with an equally tiny amount of data memory or RAM that are only capable of performing basic digital I/O. To massive 100-pin 32-bit devices with heaps of program and data memory, lots of integrated peripherals for communications, data acquisition and control. PIC microcontrollers come in a range devices:
Low-end or baseline devices – PIC16’s or PIC12’s:
- Limited feature sets – such as peripherals
Lower to middle level 8-bit devices – PIC18’s:
- Also 8-bit
- Some more advanced features
Mid-range devices PIC24’s – our recommended devices:
- 16-bit – PIC24 MCUs and dsPIC® Digital Signal Controllers
- Advanced feature sets
- Cost effective
- Excellent starting point
Top end devices PIC32’s:
- 32-bit – high end devices
- Fastest performance
From here on in our tutorials we’ll assume that you are using a PIC24 series device. We recommend these as an excellent mid-point in the PIC microcontroller range. Giving excellent performance and many advanced features, whilst still being cost effective. At Modtronics Australia we mainly use the PIC24FJ64GB004 device, with USB, and as such the tutorials are designed for this device, but should be easily portable across the PIC24 and dsPIC range.
Tools and Software
To get started with PIC microcontrollers you’ll need some tools and software:
- A PC, desktop or laptop with a spare USB port or two, running Windows 7 or XP, Linux or Mac OS X
- Microchips MPLAB X development environment
- A C compiler – these tutorials are written for C30 compiler, but should be compatible with the new XC16 compiler
- A PIC programmer, to load your programs onto the microcontroller. We recommend either the PICKit3 or better still and ICD3.
- A prototyping environment, such as Modtronics picoTRONIC24 or nanoTRONICS24 PIC24 Microcontroller Development Boards. Alternatively a prototyping breadboard and your own supply of components, to allow you to build the example circuits in the tutorials.
You’ve got many options for getting your PIC microcontroller up and running. You could use a pre-made development board, such as our picoTRONIC24 or nanoTRONICS24 PIC Microcontroller Development Boards, by far the easiest and fastest way to get going, or build your own prototyping breadboard. For this you’ll need to purchase yourself a supply of components (capacitors, resistors, and PIC microcontrollers), a soldering iron or a solderless breadboard and the necessary connectors, oscillators and the like. These parts can be obtained from component suppliers such as:
If you are going down the DIY path there are a number of good resources on the Internet, but most important advice we could give beginners is – don’t forget the decoupling capacitors!!
A Typical circuit
On all PIC24 microcontrollers you’ll find pins named Vdd (power), Vss (GND), PGC (Program clock), PGD (Program data) and /MCL (Master clear bar, active low). In order for the microcontroller to work Vdd and GND will need to be hooked up to power and ground. In order to program a device, these five pins must also be connected to the corresponding pins on your programmer (PICKit3, ICD3, ICD2 or RealICE). The Vdd supply, is 3.3 volts for the PIC24 line of microcontrollers so don’t connect it up to 5V’s!! Also don’t forget the bypass capacitor on the VddCore pin and the pull up resistor on the /MCL. These are needed for a stable power supply and program restarts, respectively.
From now, in the tutorials, on we’ll assume you are using one of our very popular picoTRONICS24 or nanoTRONCIS24 PIC24 microcontroller development boards. If you’re not, it shouldn’t matter as long as your hardware is working correctly.
Once you’ve got your hardware and software development environment setup you are ready to move onto the next section.