It has been my intention for sometime to learn microcontrollers. These days there’s a microcontroller in everything from toasters to paperweights except for my projects which so far remain as stupid as a wooden birdhouse.

Some time ago I decided to go with microchip’s PIC microcontrollers (and when I say sometime I mean years.) At this point I can’t say I actually remember why I settled on the PIC but it seems to be a fine low-priced unit with excellent support within the hobby community, that will do the kinds of things I’m interested in doing. (Hey wait maybe that’s why I picked it the first place.) I never did get around to doing anything about my intentions until several weeks ago on the occasion of my annual Christmas bonus coming to pass. I decided to seize this brief moment of financial liquidity and acquire for my very own a PIC development kit.

The PICDEM lab called out to me. I had always intended to be frugal and acquire individual components for my autodidactic journey into microcontrollers however as I absorbed the suitability of the PICDEM lab I realized it was largely the non-trivial task of determining which bits and pieces I would need which prevented me from starting this journey all this time. So I put aside my frugal ways and placed my order.

It was always my intention to do my microcontroller programming in BASIC as I’m already familiar with that language and it’s always served me well. That option is indeed possible but alas it’s not the road I’m on. It seems that C is the unofficial language of PIC microcontrollers (or maybe it is official), possibly most microcontrollers.

But that’s not so bad, as my journey continues I’m more and more convinced that C is indeed the most appropriate language for the task. When you’re coding for hardware that you built yourself from scratch the benefits of hardware abstraction run a bit thin, best to remain intimate with your ports  and your peripherals.

People say that C code is difficult to read, the meaning is obfuscated intention is not made clear. I can assure you that the people that make these observations, shit you not. I assumed I would just “pick it up” as I went through the tutorials, after all C is not that different than BASIC  math is math , logic is logic many of the important functions are the same  IF, FOR, WHILE, they’re all in both languages, how hard could it be?

Well I didn’t get very far before my optimism was quenched by my ignorance and I was forced to resort to additional educational material in order to understand example code. fortunately C is a mature language and their is a great deal of resources both online and hardcopy for those seeking to learn it.  Unfortunately, pretty much all of these resources assume you’re working on a PC, usually a PC running Linux (I have a love-hate relationship with Linux) and as such the example code relies heavily on standard I/O. Microcontrollers, of course, have no standard I/O. so my journey branches again. I found myself a lovely little piece of software called codeblocks, a nice cross-platform C development  environment.  Here I am, learning a whole branch of computer science that I did not intend. oh well, you can never learn too much right?

So that’s where my spare time has gone the last month or so.