Wednesday, October 28, 2009

The Picaxe 08- my favorite little chip

A few months ago I bought a 08 pin picaxe protoboard from Sparkfun. I soldered all the components in place and hooked it up to my PC to program. And of course, I got an error, because it would just be too easy if things worked the first time, wouldn't it? I spent a good long while resoldering all the leads and switching the chip out with other microcontrollers I had on hand to make sure it wasn't the chip's fault.

I recently bought a second protoboard to retry what I had previously failed. I soldered up the components for the new board, and 1/2 way through I realized what I had done wring the first time. I had soldered everything in correctly, but I had placed the chip in backwards! I find it annoyingly funny how I spent so much time redoing my solder joints (at least 2 or 3 times per lead) when the whole time I had just inserted the chip wrong.

Well, I learned from my mistake, and now I have not one, but two working prototyping boards. These chips are coded in BASIC, an infamously (in a bad way) old language, something like forty or fifty years I think, which translates to about 550 programming years. Be that as it may, coding in BASIC is really easy, as its just a bunch of barebones commands. I got a LED blinking demo working in about 2 minutes to test the chip.

The code looks like this:

do
high 2
low 1
pause 500
low 2
high 1
pause 500
loop


Just what do you think you're doing, Dave?


All I'm doing in this is directing current to the LED, making it turn on, pausing 1/2 of a second, turning off the LED, pauseing it for 1/2 of a second, and continue doing this until I unplug it, it runs out of batteries, or the universe implodes.

There's something oddly rewarding about programming hardware. Sure, writing security utilities in Python is fun, making games in ActionScript 3.0 is profitable (or at least for other programmers), and coding lord-knows-what in JAVA is interesting, but actually having a physical object that can do something cool in the real world is pretty unique. Now if you'll excuse me, I have an LED to watch blink...

0 comments:

blogger templates 3 columns | Make Money Online