Posts from: October '08
Week and a half ago I ordered the PICkit 2 Starter Kit. It includes a PIC microcontroller, a demo board, a PIC programmer and two CDs with development software. The embedded programming has been a field I wanted to try in since a long time, and this gadget offers an easy and convenient path to introduce one into the matter.
the demo board...
...with the programmer
It was yesterday when I finally found some free time to open the package and install the software. The processor is really simple - no more than one straight sitting to learn the instruction set, the same goes for the hardware on the board. The "Hello, world!" in the realm of microcontrollers - blinking a LED - seemed far too trivial for a first program, so I came up with something a little more interesting - blinking a LED with pulse-width modulation :)
Here it is in action: youtube
In fact, the whole thing is a little more complex than it looks like. PWM with PIC is easy, however the interesting part is how do you change the width of the pulses. It turns out that if you change them linearly, the end result doesn't look very convincing - the LED feels bright for the most part of the time, dimming abruptly only for a short moment and brightening again immediately. I discovered that an exponential pulse width scheme offers a much better effect. With the help of some 128-element lookup table (since the PIC doesn't have any floating-point hardware) and my first program was ready.
Now I have to buy some more electronics so I can start building The Thing. Beware. It is coming :D