Been thinking a lot about the PIC. I’ve decided to try the PIC on some projects. I’m going to spend some time learning the so-called “midrange” (14-bit instruction) PIC architecture. Programmming it in a structured way is going to be a bit of a challenge, but I’m liking the simplicity and directness of the design.
The PICkit 2 Starter Kit seems like a good way to jump in. This is a USB programmer bundled with a project board that will accept 8, 14, and 20 pin parts. The project board includes a (socketed) 16F690 – a quite capable 20 pin PIC. There is another board coming available, also compatible with the PICkit 2, that will accept 28 pin parts.
The PICkit 1 Starter Kit is still available, and is a bit cheaper ($36 rather than $50), but it’s not as flexible and can only program baseline and midrange parts (the 10F, 12F, and 16F families). The PICkit 2 can program practically any PIC.
For both kits the bundled programming software is Windows-only, but the source code for the firmware of both programmers is available, so using either with non-Windows programming software is a possibility.
Both kits include introductory lessons in doing things the PIC way. These make the chips quite approachable for beginners.
Now I have to decide which parts I want to play with...
I spent much of yesterday and today reading and thinking about microcontrollers. I’m going around and around and around about which families I want to invest time and money in. The money isn’t much – $50 per type, roughly – but the time can be enormous. They are all very different, appealing, and appalling, in idiosyncratic ways. I change my mind daily about which one seems like a good fit with my needs, interests, and aesthetics.
Right now the big three are
I’ve added my thoughts about these three families to microcontroller shootout.
I’d like to find one family that can do most of the things I’m currently thinking of, and perhaps re-doing some of what I’ve done with Trimpin:
- scan keyboards or switch arrays
- control lots of solenoids, using PWM, either based on internal patterns or an input MIDI stream
- blink lots of moving LEDs, making patterns or text (persistence of vision, or POV, tricks) – see Spoken Word for an example
- blink a small number of LEDs in an interesting way, to get attention (for a bicycle safety flasher)
- capture “real world” data, perhaps converting it to MIDI
- capture gestures using optical encoders, and generate an interesting, musical MIDI stream
Once I figure out a good way to wire and power both worn and bicycle-mounted lighting, I’m sure I’ll need some microcontrollers to control it all, and to deal with battery charging.
Last night, thinking a bit more about Lua (and why I like it so much), I realized the answer: Lua is a convivial tool.
That term is probably unfamiliar to you. In his landmark 1973 book Tools for conviviality Ivan Illich mounted a compelling critique of industrial society. He claimed that we cannot have a society of authentic human relations unless the tools for production of the artifacts needed by that society are under the control of the people using them. Here is a quote to whet your appetite:
I choose the term “conviviality” to designate the opposite of industrial productivity. I intend it to mean autonomous and creative intercourse among persons, and the intercourse of persons with their environment; and this in contrast with the conditioned response of persons to the demands made upon them by others, and by a man-made environment. I consider conviviality to be individual freedom realized in personal interdependence and, as such, an intrinsic ethical value. I believe that, in any society, as conviviality is reduced below a certain level, no amount of industrial productivity can effectively satisfy the needs it creates among society’s members.
This fits nicely with what I (when I remember to!) consider part of the “mission” of Nimble Machines: liberation. Not necessarily, or simply, liberation from technology, but perhaps liberation through convivial technology. As much as I might like to be, I am not a Luddite; technology fascinates me. But I cannot stomach technologies whose production or consumption is inimical to personal freedom, expression, and relatedness.
He tells the story better than I ever could. Read the book.
Then you can read why I think Lua and Forth are convivial tools.
I’ve made this page the “front page” of the site. It’s also no longer called Davids notes; it’s now called, simply, Nimble Machines. Why Nimble Machines still explains the site’s name, and recent changes logs recent activity, as ever.
Since this page is now all about you :-) and effectively your blog, I wonder whether putting my comments directly on the same page is (still) the right thing to do? --Michael Pruemm
It’s not so different than having comments enabled on a blog. I thought about this. I’m not so worried about it, esp when it’s clear which are my thoughts and which belong to others.
I’ve spent the last few days recasting my rendering code into Lua, and trying to radically restructure it. It’s been an interesting challenge; it seems more subtle than it “should” be, though perhaps I am simply getting old and slow.
I’m also interested in having the generated XHTML conform to XHTML Basic rather than XHTML 1.0 Strict. W3C have modularized the XHTML specs, to create a family of specs; Basic is a strict subset (of XHTML 1.0) that is intended to render anywhere (ie, on mobile devices and handhelds as well as desktops). It excludes presentation markup but keeps all the semantic (text) markup. It leaves out frames (yay!), and implements slightly simplified models for forms and tables, but I think my generated code will fit the simpler models.
The only element that I generate that XHTML Basic leaves out is hr; it is considered presentation (like i, b, and tt) and is thereby anathema. However, I think I can generate an empty div and style it with one edge of its box solid. So, no worries there.
But I’m not sure I want it. I like the idea of using the most parsimonious markup. hr isn’t strictly necessary, esp if I can get it by styling, say, the toplevel headings. This would make “----” even easier to use, since you wouldn’t ever have to decide when to use it, or even to type it! (In other words, “----” goes away completely. ;-)
I spent all day (16 hrs) on Friday and several hours yesterday and today converting the “wiki markup engine” from Perl to PHP. It works – the PHP code generates the same XHTML as the Perl code – but in the process I realized just how awful PHP is.
I wanted to like PHP. Leading up to actually doing this I had been reading the PHP documentation and finding irritating gotchas, idiosyncrasies, nonlinearities, and special cases. Every time I thought about starting on this project, I would feel a little bit nauseated. Finally, on Friday, I just jumped in. I enjoyed myself well enough, but discovered lots of language misfeatures, and found that I spent a lot of time struggling with the documentation. There is lots of it, but it’s hard to find anything. It describes things, but gives no sense of their underlying meaning or structure. Or subtle semantics. And it seems there is lots of subtle semantics in PHP. It is impossible to get a strong intuitive understanding of PHP from its documentation.
Having completed this task, I’m tempted to ignore PHP for as long as possible. Hopefully for ever.
Late last night, after my PHP struggles, I read a few pages of the new Lua book (the “blue PiL”) and remembered how simple, elegant, and beautiful Lua is. While I feel glum and oppressed reading the PHP documentation, I get excited reading about Lua. It seems to have no warts; every feature carries its weight, and there is nothing in the language that doesn’t belong; and the documentation (esp Programming in Lua, both 1ed and 2ed (PiL)) is clearly written and a delight to read.
I’d like to think that I can do everything in Lua. Let’s see: I’ll start by converting my pages into Lua tables, so I can use Lua as a data structure parser. Then rewrite the markup engine in Lua, using its simple pattern matcher, and maybe writing a little parser. Then write a web app to publish it. Perhaps Kepler can help.
I need a name. Hmm... Maybe “Orbit”?
Thinking again, after 18 months or so, about restructuring and rewriting this web engine.
Now all off-site links are constructed as calls to a tiny PHP script (out.php) that simply redirects to the target URI (in the query string). This way I can see how people are leaving the site. Not that anyone is actually reading it...
I still need to figure out a clean way to hide the ".php” in off-site URIs. This was a simple hack to get more interesting logs. Now to refine it.
(a bit later) Ok. Fixed. I added the following into the .htaccess file:
# So we can access "out" (a php file) w/out its extension. <Files out> ForceType application/x-httpd-php </Files>
Just now, while reading this online comic I was laughing so hard tears were streaming down my face. If you know about GNU and Linux, and know who Richard Stallman, Linus Torvalds, Eric Raymond, Bruce Perens, and Mark Shuttleworth are, you should enjoy it.
Be prepared for tears!
(BTW: if you look at the HTML for this page, you won’t see Eric R's name in it, so Google won’t index it. I added markup that inserts empty span elements, and used this to break his name into pieces. The more invisible we can make him, the better.)
One thing leads to another!
Today while thinking more about free and open source software, I thought it would be interesting to read Richard Stallman's thoughts about the differences between “free” and “open source”. Ages ago (late ’80s?) I read with interest the GNU Manifesto, and agreed passionately with his philosophy. I’ve changed my mind somewhat since then, but I wanted to revisit his story, his motivations for starting the Free Software Foundation (FSF) and the GNU Project, and the differences among all the current “free” and “open source” software licenses.
It’s a complicated world!
So now I have to do the following:
- choose a new license for muforth (again: it went from GNU GPL to Apache v2; now I want a modern (advertising-clause-free) BSD-style (perhaps MIT) license; the Apache license mentions patents unnecessarily);
- implement the change of license for muforth (sed hackery!);
- document the differences in philosophy between the “free” and “open source” software communities (or at least point to Richard Stallman's careful writings on the subject);
- talk about how influenced and moved I was initially by the philosophy behind the GNU GPL (copyleft!), but how I now believe in more permissive licenses;
- take some time to go outside and enjoy a bit of sunshine!
Lots to do.
I was reading (on this blog) about Erlang last night, and it struck me that O’Reilly books dont interest me. While supposedly about technologies for early adopters, their books are mostly about free and open source software that is a product of the church of ad hockery. And to make money, O’Reilly has to publish popular books – so they can hardly be on the leading-edge of adoption.
Should my O’Reilly rant instead be called O’Reilly is irrelevant?
A new look for the site! Comments?
Changed the wiki code to generate more “typeset” output for quotes and dashes. This means that pasting code from the web into an editor causes trouble, but it’s much nicer to read. (Sorry, Michael!)
I also added a “comment” link to the footer of every page that is viewed readonly. Right now it is a mailto: link; it could later be a simple web-form that sends email to the configured webmaster.
Added Spoken Word – project page for my bicycle wheel text flasher/speller thingy.
Change “voices” styles so that any voice other than the first (default) voice is shifted to the right (3pc left indent, -3pc right indent).
What do you think?
I think it looks a bit odd. Other voices are not quotations, but now somehow look like they are. I am also not sure (meaning I haven’t looked for pages with many voice changes) how a switch back to the first voice is handled. The different color makes the voices stand out enough, IMO.
(BTW, I think the right indent doesn’t work.)
Actually it does. I drew colored boxes around the div’s and you can see that it goes further to the right, but because the text is ragged right, it’s harder to see.
What I would like to see is a way of having a discussion with multiple voices, with a second “default” voice for the original author that is used to distinguish his replies to other voices from the original text of the page. How should that be displayed? --Michael Pruemm
Well, what’s wrong with what we’re doing now, using voices two and three? I think it looks fine, and it’s easy enough.
Excited about the Lua programming language!
So, I finally put together – but not with the “final” parts – my Motobecane fixie (fixed gear bicycle) project. Last night at 1:30am I rode it for the first time. It was weird. Starting and stopping is hard; balancing and riding slowly is easy.
Today I rode around in tight circles, clockwise and anticlockwise. I was also trying to do trackstands; I can do one for about five seconds. The record is held by an Italian track racer, who apparently did a trackstand for an hour and five minutes!
My latest obsession (taking a break from microcontrollers): the fixed gear bicycle. Why would you want to ride a one-speed bicycle that won’t let you coast? Hmm...
Since I’m thinking about using the Freescale 908QB8 in some projects, I thought I’d make a quick link here. (I’ve decided to use the 9S08QG8 instead – a newer variant.) There is more info in the microcontroller shootout.
Reading about the MSP430 instruction set makes me want to write the real story of carry and borrow. Like the 6502 and the ARM, the MSP430 implements a “natural” borrow (logically “not carry”), rather than a synthesized borrow. I appreciate architectures that do this.
Ok, so that’s fixed. Phew. I captured the modtimes of the old pages files, applied them as properties to the new pages, checked them in, and modified the wiki script to use the “modtime” property from Subversion when it makes the “last edited” link. Everything works fine.
Well, this sucks. Every time I ran svn update on the pages directory, it touched all the files, making them appear as if they had been recently edited. Now the “last edited” link at the bottom of every page is wrong.
I suppose, since I’m now using Subversion, that I could attach a property to the page with its last edited time. Seems redundant, but maybe that’s the best & most robust solution.
Add ARM development boards, fig-FORTH, and demystifying create does.
One more thing. Added code to the wiki so that newly-added pages get added to svn.
Built a new repo and migrated the wiki pages. Let’s try this again...
That sort of worked. It checked into the repo, but the command returned some junk that confused the wiki script. Now we’re concatenating the command output to a log file...
Actually running svn --quiet seems to work. But now I can’t get decent info at the command line from svn log...
Never mind. It’s working fine. Just Subversion confusion: in order to see the latest log entries you have to svn update first.
Ok. Testing the svn ci tweak. That didn’t work. I just realized that the www user does not have write permission to the Subversion repo, and that’s not something I want to change... So I’ll have to make a www-only repo with the pages in it.
That worked beautifully! Now I can use
svn st pages
to see what has changed (status), and
svn di pages
to see (diff) the changes, and
svn ci pages
to check them in! Maybe later today I can fix the wiki script to check-in automagically...
This is a test.
I checked the wiki pages into Subversion as a separate “project” from the wiki code itself. This way two things are possible:
- working on the wiki code without a heap of pages that you don’t care about;
- using Subversion to track changes to the pages, by simply adding
svn ci -m "page edited"
to the wiki script! This makes the page archive directory obsolete.
As soon as I figure out how to do diffs nicely using Subversion I’ll deprecate (ie, delete) the archive entirely.
Thinking again what would be a good first motorcycle. Mostly I found some nice pictures of the Kawasaki Ninja 500R (aka EX500R) and wanted a place to put them.
A (dumbish) idea: a latest pix page! There you can find a flickr badge with my latest pix, should I ever either:
- get in the habit of taking pictures and uploading them regularly; or
- get a camera phone, and take & upload pictures regularly.
Looking at my weblogs. Wow! People are actually finding the site on Google! A few people searched for Rivendell Bicycle Works, for “klr motard”, for “dual-purpose motorcycle”, and for “muforth” and found me! Cool!
In particular I wanted to put up a muforth page so that I could mention the program there, and solicit comments.
Adding markup for obfuscated mailto links. Like so:
[[mailto:email@example.com email me]]
renders as email me. The link text is necessary, and should be something other than your email address!
I added this as a way for people to contact me thru the wiki.
After the relative pain of adding the flickr markup to the wiki codebase – Perl bites! – I’m thinking again, seriously, of rewriting this beast in a nicer language, and one that I would enjoy more. The main contenders, as usual, are:
It would be a good learning experience, the same way that writing this wiki helped me learn (and learn to hate) Perl.
Update: Since Flickr no longer supports “badges” I’ve removed the demonstration badge from this page.
I tried to put the images on a colored background, but I was unable to get it to style properly. Either the band of color was a little strip (the height, interestingly, of a line of text), and was the right width, or it was the right height (tall enough for the tallest image) but the width of the page.
It’s not important – I think it looks nice without a background – but does anyone know how to style this (I tried wrapping in another div, but to no avail) to make this work?
Amusing footnote. I changed the script to use public photos tagged with “nimble” and “machine”. Guess what? In flickr’s millions of photos, there isn’t a single one tagged that way.
When good enough isnt good enough. ;-)
Read the 2005 journal.