# Picking a microcontroller

I am looking to move away from arduino, and start some projects using more feature-rich microcontrollers. I have been looking at the PIC18F4550 for its feature set, but I am shying away from the PIC products, mostly because I don't have a programmer, and the picKIT is a bit pricey ($50 for picKIT II,$70 for picKIT III). I haven't done as much research into AVR offerings, but I think I may want to. Here's what I'm looking for:

1. 32+ Digital I/O pins
2. Programmable with minimal external hardware. Bonus points if I can leverage the usb chip on an arduino dev board, or my ftdi-usb cable to program it on the cheap.
3. Built in USB. This is one of the reasons I really was leaning toward the 18F4550. Is there a comparable AVR chip that has built in USB capabilities?
4. Good online resources- I would like to learn straight assembly, and it would be good if there were good resources online for learning assembly for my platform without having to read a 500 page datasheet.
5. Through hole mounting.
6. Minimal external circuitry to get running. An internal oscillator would be cool for fast prototyping, but I have no problem throwing a crystal in if I have to.

Anybody have any recommendations one way or the other?

• If you're looking to start with more powerful microcontrollers, a picKIT will be a small fraction of your investment. Also, the PIC18 is very comparable to the ATmega on the Arduino. How much more power do you want? Finally, #5 - Through hole mounting - will limit your options very much. I understand that you might like breadboarding, or be uncomfortable with fine soldering, but powerful micros are surface mount and it's hard to get around that. – Kevin Vermeer Sep 20 '11 at 10:47
• Maybe my question is misleading. I am ok with the computing power of the arduino, but several projects I am thinking of need more IO, peripherals, program memory, etc... I will have my boards made professionally, and I'm ok with basic surface mount soldering, but really only the widest pitches. – captncraig Sep 20 '11 at 15:01
• That makes more sense. Edited the text to reflect this. Also, you should read the diatribe/mantra at electronics.stackexchange.com/q/16868/857 about the importance of datasheets; reading the datasheet is mandatory if you are serious about electrical engineering. – Kevin Vermeer Sep 20 '11 at 15:34
• I am not necessarily opposed to data sheets, I just have a hard time learning from them as a primary source. Its much easier if somebody explains the features and basic usage to me first, so I know what I'm looking for in the datasheet. – captncraig Sep 20 '11 at 16:14

Although the PIC18F4550 is a decent uC and there are quite a few examples out there of using it for USB, it's still 8-bit and probably in the same "league" as your Arduino.

If you want a bit more power, I would maybe look at the 16-bit PIC24/dsPIC (a lot more powerful and still available in through hole) or even the PIC32 (surface mount only though, and you would generally use C to program it)

I thought the PicKit3 (I assume you are referring to this) was not too bad price wise as programmers go, but if you want cheaper you could go for the PicKit2, which although not officially supported anymore, will still be usable with 99% of Microchips range.
There are also many other decent programmers for PICs, for example the Embed Inc offerings - if you go for the 16-bit 3.3V parts I imagine the $25 LProg would be suitable. Although online resources and a good related book (e.g. Learning to Fly the PIC24 - note this is C based) makes getting started easier, I would get used to reading the datasheets (and Family Reference Manual in the case of the PIC24/dsPIC) thoroughly, it is a necessary part of using any microcontroller and the only way (IMHO) to learn how to use them fully, especially the more complicated ones. Even the above book (though well written) misses out a lot of lower level detail. • At$25 the Microchip PIC Stick is pretty low cost microchip.com/stellent/… – kenny Sep 20 '11 at 0:37
• I also have one of these ebay.com/itm/… – kenny Sep 20 '11 at 0:41
• @kenny - they look like pretty good options too. Especially the second one which looks to support 3.3V and 5V from PIC10F to PIC24 at ~$21 inc P+P. @ CMP Would be worth checking the supported device list (with any programmer) before buying to see if the chips you want to use are included. I got burnt with a Wellon programmer once by not checking carefully (>10,000 devices supported, unfortunately 95% of them well over 5 years old and no longer any firmware upgrades...) – Oli Glaser Sep 20 '11 at 0:54 • Yeah, there are some device limitations with that programmer, it's 'compatible' with the PicKit2. – kenny Sep 20 '11 at 1:02 • The design is kind of cheap, but it's well made. The USB cable's short, so you probably need an extender. Rather than a housing it has the yellow 'shrinkwrap'. – kenny Sep 20 '11 at 5:40 Personally I swear by the PIC chips. I often swear at them too. Yes, you get lots of IO pins. Yes, you get an internal oscillator. Yes, you get built-in USB, CAN, SPI, I²C, ADC, DAC (on some dsPICs), the kitchen sink, and even the moon on the stick. Alas the online support is sketchy at best. There is a quite comprehensive Application Library available for download, but the way it has been put together leaves a lot to be desired. You say the PIC programmer is a bit pricey? It needn't be. I use a cheap clone off ebay. It doesn't have all the bells and whistles (no debugging), but it works well for me and all the major programming software works with it. The hardware is open-source - you can download the schematics and firmware from Microchip if you want. You can also download the specs of how to perform programming if you want to create your own programmer - it's just serial, so (apart from the +12V Vpp) you should be able to create a programmer using an Arduino. As for others... I know that the new Arduino UNO boards have replaced the FDTI chip with an Atmel MEGA8U2 chip, which has USB built in. I'm not sure if this is available as a PDIP or not. 1 & 5: There are many Atmel AVR models that come in 40-pin DIP package, which meets these requirements. A 40-pin model that I am using now has 4 8-bit IO ports == 32 IO (if not using any other peripherals) 2: The arduino is able to achieve this method of programming using its bootloader - which is something that always resides on the chip's flash memory. To program over UART (which is what the arduino is doing for programming) may require a bit of work. Here's some more information about the bootloader if you're curious. The good news is you won't need any of that if you use an ICSP programmer which requires no external circuitry. 3: Look here and use ctrl+F in your browser to find parts with USB support. 4: Both PIC and AVR have a ton of resources for learning. Do not try to avoid reading a datasheet though - this is absolutely essential and I don't how you will be able to get by without it if you want to write firmware (assembly or C) on any platform. 5: See first point. 6: Internal oscillators are almost a standard feature these days. Again, consult their product description or consult the datasheet to know for sure. Example: Clicking on a random part on Atmel's site and scrolling through the parameters reveals a field that tells you Calibrated RC Oscillator: yes <-- this means there is an internal oscillator. I wouldn't worry a whole lot about which one (PIC or AVR) you end up choosing. Either way, you'll most likely have to buy an ICSP programmer though. I'm afraid if you insist on both USB and through-hole, then you're probably stuck with either AVR or PIC. Most of the "big guys" use QFP or QFN for chips with USB and enough pins to have 32 GPIOs. Using a QFP breakout board is not that difficult, however. If you're willing to try that, here's a couple I can suggest: 1) MSP430. A nice low-power 16-bit architecture, sane instruction set, pretty simple (IMO) peripherals. A$4.30 kit is available as a risk-free intro (includes programmer and debugger). However, DIP parts such as on the Launchpad are quite limited and you'd have to go QFP if you want something for your requirements

2) A Cortex-M3 or Cortex-M0 ARM chip. There are several offers on the market, for example LPC series from NXP (check LPCXpresso, around $30) or STM32 from ST (STM32VLDISCOVERY, around$12). These beauties are 32-bit so have plenty of power, but are somewhat more complex than the 8-bitters.

Why don't you stick with Arduino, because Arduino Due will use Atmel SAM3U ARM-based MCU?

If you want to learn assembly language I suggest getting a good Programmer that supports Debugging. These are generally more expensive (\$50-100) but when you have a bug that you just can't figure out there is nothing better than seeing what is going on inside the MicroController. Since you are coming from the Arduino world you are probably very used to Debugging using data output over a serial port, but especially if you want to learn assembly language just getting a Serial Port enabled without a debugger is going to require "Coding in the dark".

I have really taken a liking to the ATXMega. Many of the Atmel chips can be programmed in C using the Atmel Software Framework which has great examples and does a great job at hiding the use of Pointers (which is the big advantage w/Arduino programming) It meets all of your requirements above including some with USB and especially the I/O with 34-78 in 44 to 100 pin packages, except it's only available as Surface Mount but I have soldered it by hand with a soldering iron some solder wick and a 7x magnification to verify there weren't any solder bridges.

I really like Atmel Studio, I'm a little biased because my day job uses Visual Studio and Atmel Studio is based on it. Debugging in Atmel Studio is really nice with all of the Configuration Registers and their states clearly visible I've been able to test custom manufactured PCB's using only a main() method and the debugger.