19 April 2008

12. Which Pic?

If you’re anything like me, you’ll have had a look at the Microchip web site and been completely overwhelmed by the choices available to you. There are literally thousands of types of pics. How do you choose?

To some extent that depends what you want to do with it, but that’s not a very helpful answer. What I think is more important as you get started is using chips that make development easy. Once you’ve got something developed, if you were to actually take it to market, you’d simply choose the cheapest pic that had all the features you needed – and microchip’s web site includes tools for searching based on all sorts of criteria.

I think the essential things are
a) A hardware UART (serial port)
b) Plenty of flash memory for instructions
c) Support for the tools you use - not all hardware programmers support all pics!

If you’re starting out, I think the best pic to get going with is the fabulous 16f88. It’s got 4k words of instructions, which is plenty for experimenting with. It has 256 bytes of EEPROM for settings, 384 bytes of RAM and ports A and B. It runs at 8Mhz using the internal oscillator, giving you 2 mips and can run at 5 mips with a 20Mhz crystal. It can actually run an entire multi-hop meshed RF connection in 4k, but only just.

Once you start to run out of memory, flip over to the 16f876A. This guy has 8k words of instructions and because it has more pins, it has an extra port C. Other than that, it’s pretty similar.

The Sure PicDem2 board has an 18f4520 on board – this baby has 16k words of instructions, 1536 bytes of RAM and can run at 10 mips on a 10Mhz crystal. Sweet! Since I want to use the Olimex boards for experimenting without having to do surface mount, I’m also looking at the 18f2620, which stores 32k words of instructions, 3986 bytes of RAM and 1024 bytes of EEPROM. That’s one seriously pimped up pic. I’ll post when I’ve got the boostloader working on it.

Avoid any pic with 12 bit instructions. Most 16f pics have 14 bit instructions, all 18f guys have 16 bit instructions. I got a bunch of the funky Sure 5x7 LED array displays, with a view to reprogramming the pic on the back, but it turns out to be a 16f57, which BoostC doesn’t support as it has 12 bit instructions.

Printing things out to the serial port chews up instructions like you wouldn’t believe. I think it’s better to have plenty of Flash and not have to spend time cutting your program down just to get it working – once you’ve got it working, that’s the time for optimising.

No comments: