20 years ago, the devices were so small (RAM/ROM/Flash) and there were so few variants that developing in assembly was not too bad. With the variations of chips today, it would be foolish to write almost anything for these microcontrollers in assembly. If you are old enough, or hard core enough, you know that writing reusable and modular (library) code in assembly is akin to stabbing a pencil in your own eye (it hurts). A simple example would be to imagine upgrading code on a PIC that had a single W register to a PIC with 4 W registers. Sure you could just migrate the code, but all that optimization that could be leveraged is lost! Hence, we have C.
I will be the first to admit from a hardware size, what I have at hand is pretty nice. I have a handful of powerful and flexible PICs at my disposal. However, the compilers are really starting to wear me down.
- The free compiler (from Hi-Tech) is almost worthless when the optimization expires
- The available C compilers are between $150 and $500
- Don't forget about maintenance
- Due to copy write restraints, I cannot share with my readers how I customized the code to fit a particular situation
- If the reader does not have the compiler, my source code is all but worthless
- You help $timulate the economy by buying a new compiler for each chip family (16 vs 18 vs 24).
Of course hindsight is 20/20. Right now, as I look over my shoulder I wish I would have dropped $50 on the AVR Dragon instead of the PICkit2 (mind you, the PICkit2 really is a fantastic setup). So, I implore you to not follow my path and shift (or start) with the AVR as soon as possible. And, I hate to say it. I don't think you (or I) will look back and think we made the wrong decision. Look at some of the benefits:
- tried, true and free compiler with GCC
- -O 3 (gcc's optimization flag)
- The $ that would be spent on the compiler can go towards a logic analyzer, Oscope or a bench power supply
- Ability to switch among device types w/o buying a new compiler for each
- Ever growing list of user created libraries that you can freely copy, change, enhance, and share
- 1-wire
- I2C
- USB
- Manchester encoding
- RS232
- Wireless modules
- List is long and keeps growing
- AVRfreaks as a resource (yes, they are a wee bit hostile towards PIC people)
- Hobbyist and Magazine support is bar none
- Let's not forget the quick and simple Arduino
- I consider all the other items (price, features, pin count, availability) to be the same
No comments:
Post a Comment