Title: Getting Started with PIC Microcontrollers
1Getting Started with PIC Microcontrollers
- Kelly Flowers NN8E
- April 18th, 2011
2My Background
- Licensed in 1979
- Education BSEE 1981
- Licensed Professional Engineer (Ohio)
- Former NOARS member (80s and 90s)
- Worked for Allen-Bradley/Rockwell for 25yrs
- Worked with computers and microprocessors since
1979 - Began working with PICs in late 90s
3What am I going to cover tonight?
- PIC background, purpose, value proposition
- PIC architecture (whats it look like inside one)
- How can you use one?
- PIC system overview(dev s/w, programmer, target
or protoboard) - Programming language choices(Assy, Basic, C)
- Simple examples / hands on
- Recommended resources
Just want to whet your appetite tonight!
4The 411 on PICs
- Peripheral Interface Controllers came along in
the 90s from Microchip - Small pin count microcontrollers intended to be
smart and fast I/O front ends for more
traditional microprocessors - Not intended to have big number-crunching ability
- Hundreds of PICs and dsPICs
5Why are they so popular?
- Cost!
- Per piece cost is low, typically under 5
- Software development environment needed to
program the devices is FREE (MPLAB IDE) - Programmers are low cost
- Learning curve is fast(low of instructions)
- Proliferation of hardware, software, books
- Backward compatibility
- Higher level language compilers(Basic, C)
- Canned serial comms (RS232, SPI, I2C)
- Flash memory based, quickly re-programmable
- Minimal support parts needed
6The simplest of PICs
This even has analog input capability!!!
7(No Transcript)
8General PIC project overview
PIC
INPUTS Digital Analog
OUTPUTS Digital
SERIAL DEVICES (displays, EEPROM, RTC, smart
sensors)
9What do you need to get started?
- PC to load development software(MPLAB) on to
- Programmer which connects between PC and your PIC
- Target or protoboard or your actual project board
to test your program!
10The simplest of PIC projects
Even the 12F675 supports ICSP!
11What is MPLAB IDE?
- This is the program you download to your PC to
get started with writing your first program - Integrated Development Environment
- Free integrated software tool set for developing
and troubleshooting programs for embedded
applications using PICs - Easily integrates with 3rd party software such as
high level language compilers - Really high quality, professional grade software
- The bad news is Microchip upgrades it a lot and
every few generations changes the look and feel!
12Programming Language Choices
- Assembly language is the lowest level
- No extra cost to use
- Fastest
- Manipulating things at the bit level
- Not easy to do higher level tasks like serial
comm and math
1335 Assembly instructions (mid-range)
14Two Higher Level Choices
- BASIC
- Micro Engineering Labs
- C
- Multiple vendors (I use CCS)
- Free light versions
- Popular with scientists and engineers
- High level languages are used to simplify more
complicated tasks like math and serial
communications - Microchip made using these with MPLAB a breeze!
- Typically execute more slowly than Assembly
programs doing the same thing, but this is not
usually a problem - The full versions cost 100 to 300
15Youre gonna need a Programmer
16Putting it all together
- Picture your final project(I like to do the
hardware design first) - Download MPLAB or install it off supplied disc
- Connect programmer with blank PIC installed
- Launch MPLAB and set up for proper PIC and the
type of programmer you are using - Write your program(or use an example) and build
till you have no errors! (the hard part) - Try it out! Do this as many times as needed
since you can keep erasing and reprogramming in
seconds!
I recommend the PICkit 2 ARRL Book
17Project Thoughts.
- Keyer
- Test equipment
- Freq counter
- Signal gen (DC to Daylight with DDS board!!!)
- SWR / power meter
- Repeater control
- Automatic control of anything!
- Hobby servo control
- Any timing and/or counting applications
- Holiday lights
- Home automation
18Resources
- Microchip website
- MPLAB, PICkit 23, ICD 23, datasheets, app notes
- ARRL PIC Programming for Beginners
- Hellebuyck Beginners Guide to Embedded C
Programming - Square 1 website(www.sq-1.com)
- Wilmshurst Designing Embedded Systems with PIC
Microcontrollers - Nuts and Volts magazine
- www.sparkfun.com
- Programmers, proto boards, parts
- www.best-microcontroller-projects.com
- Tutorials, projects
- www.olimex.com
- Excellent cheap proto boards(available at
sparkfun) - www.kangaus.com PIC-EL II proto board, docs
- www.digikey.com, www.mouser.com, www.jameco.com,
www.newark.com PICs and parts - GOOGLE!!! EBAY!!!