<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-16578308</id><updated>2012-01-27T21:16:56.669-05:00</updated><category term='arrayForth'/><category term='ideas'/><category term='EVB001'/><category term='robotics'/><category term='GreenArrays'/><title type='text'>Copious Free Time</title><subtitle type='html'>Ramblings about projects I work on during my "copious free time" (CFT).</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default?start-index=101&amp;max-results=100'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>148</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-16578308.post-529395957976316231</id><published>2012-01-23T21:19:00.003-05:00</published><updated>2012-01-23T21:19:58.975-05:00</updated><title type='text'>True Modular computing</title><content type='html'>I want to tie together my past 3 posts. &lt;br /&gt;In &lt;a href="http://toddbot.blogspot.com/2012/01/multi-computers-ga144-vs-multitasking.html"&gt;Multi-computers vs multitasking vs interrupts&lt;/a&gt;&amp;nbsp;I stated a problem (concurrent processing within the embedded realm) and teased you with a solution (GreenArray's GA144).&lt;br /&gt;&lt;br /&gt;In &lt;a href="http://toddbot.blogspot.com/2012/01/costs-of-multiple-mcu-system-back-of.html"&gt;Costs of a multiple mcu system&lt;/a&gt;&amp;nbsp;I backed a bit away from the GA144 and wondered if a bunch of small, efficient and cheap MCUs could solve the problem.&lt;br /&gt;&lt;br /&gt;In &lt;a href="http://toddbot.blogspot.com/2012/01/building-devices-instead-of-platforms.html"&gt;Building devices instead of platforms&lt;/a&gt;&amp;nbsp; I offered a rationale to my pondered approaches.&lt;br /&gt;&lt;br /&gt;So, here I sit composing an interrupt for an 8051 to service a GSM modem's UART (essentially to buffer all the incoming data). &amp;nbsp; And... everything has just gotten complicated. &amp;nbsp;I've been here before. I am no stranger to such code and the approach I am taking is text book. &amp;nbsp;This is how code starts to get hairy and unpredictable.&lt;br /&gt;&lt;br /&gt;But, really now... maybe I *should* consider breaking my tasks down into hardware modules (with each module consisting of dedicated software). &amp;nbsp;If I dedicated an 8051 (tight loop, no interrupts) to just talking to &amp;nbsp;the modem, collecting responses and sending just the relevant information to another 8051 (perhaps through I2C or SPI), then I build that module once, debug it once and be done with it.&lt;br /&gt;&lt;br /&gt;This is modular design, isn't it?&lt;br /&gt;&lt;br /&gt;So (during design) every time I find a need for an interrupt, I just fork another processor?&lt;br /&gt;&lt;br /&gt;(This would work with a single GreenArray's GA144 as well as $3 Silabs 8051 MCUs)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-529395957976316231?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/529395957976316231/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=529395957976316231' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/529395957976316231'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/529395957976316231'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2012/01/modular-hw-computing.html' title='True Modular computing'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-2575059348750956899</id><published>2012-01-23T09:08:00.000-05:00</published><updated>2012-01-23T09:08:29.131-05:00</updated><title type='text'>Building devices instead of platforms</title><content type='html'>The title of this posting is a concept that flies in opposition to conventional wisdom. &amp;nbsp;Everything seems to be a platform these days. When you buy a gadget or appliance you are not buying a device, you are investing in a platform. Refrigerators are appearing with &lt;a href="http://www.technologyreview.com/blog/mimssbits/27101/"&gt;Android embedded&lt;/a&gt;. &amp;nbsp;We are looking at a future of doing "software updates" to our appliances!&lt;br /&gt;&lt;br /&gt;Of course, there is big talk about the "Internet of Things", and that could be grand (my washing machine could one day query my fridge about the tomato sauce stain it encountered on my shirt and then place an order on Amazon for the correct stain treatment product).&lt;br /&gt;&lt;br /&gt;But, the consider the "elephant in the room": these devices will suffer from that dreaded of all software plagues: "ship now; fix later in an update".&lt;br /&gt;&lt;br /&gt;This doesn't tend to happen when you talk about your appliances and devices containing "firmware" (in the original sense). My washing machine has embedded microprocessors but there is no evident way to upgrade the firmware. Hence, the engineers have got to get it right before it ships. &amp;nbsp;The software is apparently sophistica&amp;nbsp;Of course, this is not always the case, but the "get it right" mindset is there. You don't want to tell people they have to call a service technician and "upgrade" their washing machine when it locks up.&lt;br /&gt;&lt;br /&gt;For all the smarts my washing machine has, it is still a "device" (not a platform).&lt;br /&gt;&lt;br /&gt;This rant bleeds into the common "old fogy" rant that a cell phone should be (just) a phone. &amp;nbsp;I don't think we need to start limiting the potential of our devices, but there are some that should just "work".&lt;br /&gt;We are losing that when we start designing a device and our first step is to choose an OS.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-2575059348750956899?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/2575059348750956899/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=2575059348750956899' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2575059348750956899'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2575059348750956899'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2012/01/building-devices-instead-of-platforms.html' title='Building devices instead of platforms'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-4512631605114344786</id><published>2012-01-20T23:21:00.000-05:00</published><updated>2012-01-20T23:21:22.059-05:00</updated><title type='text'>Costs of a multiple mcu system (back of envelope)</title><content type='html'>If physical size isn't an issue (you don't want the tiniest of footprints) &amp;nbsp;and unit cost isn't measured in cents, have you considered a multi-mcu system? &amp;nbsp;If your system is highly interrupt driven (receiving lots of I/O from more than 1 place), then you'll need either an OS or at least some solid state based design to handle the concurrency.&lt;br /&gt;&lt;br /&gt;If I can get 3 Silabs 8051 variants for between $12-$15, I would need just around 6 caps and resistors to get it up and running. &amp;nbsp;So, total MCU costs would be $15 max. These old 8-bit workhorses are self contained systems. They rarely need an external crystal, often come with built in regulators, and are meant to have a low passive component count. &amp;nbsp;You can just "drop" them in with just a few millimeters of board space.&lt;br /&gt;&lt;br /&gt;What does this get me? Potentially less complexity for the software. &amp;nbsp;Consider assigning your MCUs as thus: Each I/O subsystem gets its own MCU for processing. &amp;nbsp;You can design, code and test each subsystem separately. &amp;nbsp;With a means of message passing (SPI, shared memory/flash, etc) you now have an integrated system. &lt;br /&gt;&lt;br /&gt;This is hardware based functionality factoring. &amp;nbsp;The industry already does this. If you have bought a GPS module, a cellular modem or even an (micro)SD card you have bought an MCU+X (where X is the functionality). &amp;nbsp;Peripherals often come with their own embedded MCUs (with custom firmware) . &amp;nbsp;However, we expect those peripherals to be (relatively) flawless.&lt;br /&gt;&lt;br /&gt;Software, on the other hand, is under constant revision, &amp;nbsp;bug fixes and improvements.&lt;br /&gt;&lt;br /&gt;Consider this: If you buy a memory hardware module that has built in support for FAT filesystems (maybe accessed via a UART or SPI), then you expect that hardware module to work perfectly. It is a $5 piece of hardware that should work out of the box. There is no notion of "field" upgrades. &lt;br /&gt;&lt;br /&gt;However, if you have bought (or downloaded) a FAT filesystem as a software library, you'll see a few revisions/improvements with a release cycle. It doesn't have to work perfectly. You are expected to upgrade occasionally.&lt;br /&gt;&lt;br /&gt;Hardware is getting cheap enough that (for small unit counts) we should seriously consider multiple MCU systems.&lt;br /&gt;&lt;br /&gt;Curiously, GreenArrays has side stepped this issue and simple incorporated a bunch of small MCUs into one package.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-4512631605114344786?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/4512631605114344786/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=4512631605114344786' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4512631605114344786'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4512631605114344786'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2012/01/costs-of-multiple-mcu-system-back-of.html' title='Costs of a multiple mcu system (back of envelope)'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-3016777152366134986</id><published>2012-01-20T20:51:00.002-05:00</published><updated>2012-01-20T20:51:31.875-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GreenArrays'/><category scheme='http://www.blogger.com/atom/ns#' term='arrayForth'/><category scheme='http://www.blogger.com/atom/ns#' term='ideas'/><title type='text'>Multi-computers (GA144) vs multitasking (ARM) vs interrupts (8051/MSP430)</title><content type='html'>You've got a system to design. &amp;nbsp;It is a multi-sensor network that ties to a small, efficient battery run base station. The sensor nodes are straightforward. You start thinking about the base station:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;i&gt;I've got a barrage of data coming at me over the air at 433Mhz. &amp;nbsp;I have a simple 2 byte buffer on the SPI connected transceiver so I don't have a lot of time to waste on the MCU. I must be there to receive the bytes as they arrive.&lt;br /&gt;Once I've received the data, it must be parsed into a message, validated, logged (to persistent storage) and perhaps correlated with other data to determine if an action must be taken. An action can also be timer based (scheduled). Oh, and I must eventually acknowledge the message receipt or else the sender will keep sending the same data.&lt;br /&gt;Additionally (and unfortunately), the action I need to perform may involve dialing a GSM modem and sending a text message. This can take some time. Meanwhile, data is flowing in. &amp;nbsp;What if a scheduled event must take place and I'm in the middle or processing a new message?&lt;/i&gt;&lt;/blockquote&gt;&lt;br /&gt;Now, this is the sort of thing that you would throw a nice hefty ARM at with a decent &amp;nbsp;OS (maybe linux) to do multitasking and work queue management. &amp;nbsp;But, let's think a second... Most of what I've just described works out to a nice simple flow diagram: Receive data -&amp;gt; parse data into message -&amp;gt; reject duplicate messages -&amp;gt; log message -&amp;gt; correlate message with previous "events" -&amp;gt; determine if we need to send a text message -&amp;gt; send text messages at specific times -&amp;gt; start over.&lt;br /&gt;&lt;br /&gt;Each task is pretty straight forward. &amp;nbsp;The work is not CPU bound. &amp;nbsp;You really don't need a beefy ARM to do each task. What we want the ARM to do is to coordinate a bunch of concurrent tasks. Well that will require a preemptive OS. &amp;nbsp;And then we start down that road... &amp;nbsp;time to boot, link in a bunch of generic libraries, think about using something a little more high level than C, etc. We now have a fairly complex system.&lt;br /&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;i&gt;And, oh... did I mention that this must all run nicely on a rechargeable battery for weeks? &amp;nbsp;And, yank the battery at any time -- the system must recover and pick up where it left off. &amp;nbsp; So, just having a bunch of preemptive tasks communicating via OS queues isn't quite enough. We will probably need to persistent all queued communication. &amp;nbsp;But I am getting distracted here. &amp;nbsp;The big system eats a little bit too much power...&lt;/i&gt;&lt;/blockquote&gt;&lt;br /&gt;Okay, so we get a bit smaller. Maybe a nice ARM Cortex-M3 or M0. &amp;nbsp;Okay, the memory size is reduced and its a bit slower than a classic ARM. &amp;nbsp;A preemptive OS starts to seem a bit weight-y.&lt;br /&gt;&lt;br /&gt;So, how about a nice MSP430 (a big fat one with lots of RAM and program space). &amp;nbsp;Now start to think about how to do all of that without a preemptive OS (yes, I know you can run a preemptive time-sliced OS on the MSP430, but that is a learning curve and besides you are constraining your space even further). &amp;nbsp;Do you go with a cooperative OS? &amp;nbsp;Well, now you have to start thinking about a states... how do you partition the tasks into explicit steps? &amp;nbsp;At this point you start thinking about rolling your own event loop.&lt;br /&gt;&lt;br /&gt;So, then there are the interrupts:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;i&gt;Oh, I forgot about that. &amp;nbsp;The SPI between the MSP430 and transceiver. The UART to the GSM modem. And the flash. Don't forget the persistent storage. &amp;nbsp;And &amp;nbsp;check pointing, the system needs to start where we left off if the battery runs out.&lt;/i&gt;&lt;/blockquote&gt;&lt;br /&gt;Okay, you are getting desperate. You start thinking:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;i&gt;&amp;nbsp;What if I had one MCU (MSP430, C8051, whatever) dedicated to the transceiver and one dedicated to the GSM modem. &amp;nbsp;The code starts to get simpler. &amp;nbsp;They'll communicate via the persistent storage.... But, who handles the persistent storage? &amp;nbsp;Can the transceiver MCU handle that too? &amp;nbsp;&lt;/i&gt;&lt;/blockquote&gt;&lt;br /&gt;This is where thoughts of multi-computers &amp;nbsp;come in. Not multi-cores (we are not CPU bound!), but multi-computers. &amp;nbsp;What if I had enough computers that I could dedicate each fully to a task? What if I didn't have to deal with interrupts? &amp;nbsp;What would these computers do?&lt;br /&gt;&lt;br /&gt;- Computer A &amp;nbsp;handles the transceiver&lt;br /&gt;- Computer B &amp;nbsp;handles logging (persistent storage interface, indexing, etc)&lt;br /&gt;- Computer C &amp;nbsp;handles the GSM modem (AT commands, etc)&lt;br /&gt;- Computer D &amp;nbsp;handles parsing and validating the messages&lt;br /&gt;- Computer E &amp;nbsp;handles "scheduling" (time based) events&lt;br /&gt;- Computer F handles check pointing the system (for system reboot recovery)&lt;br /&gt;etc etc etc&lt;br /&gt;&lt;br /&gt;This is where I start really, really thinking that I've found a use for my GA144 board: &lt;b&gt;Performing and coordinating lots of really simple tasks.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;It becomes GA144 vs ARM/Cortex + Linux.&lt;br /&gt;&lt;br /&gt;Now if I can only figure out how to do SPI in arrayForth...&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-3016777152366134986?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/3016777152366134986/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=3016777152366134986' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/3016777152366134986'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/3016777152366134986'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2012/01/multi-computers-ga144-vs-multitasking.html' title='Multi-computers (GA144) vs multitasking (ARM) vs interrupts (8051/MSP430)'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-7828869081196642622</id><published>2011-11-20T11:44:00.001-05:00</published><updated>2012-01-20T20:51:59.854-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GreenArrays'/><category scheme='http://www.blogger.com/atom/ns#' term='arrayForth'/><title type='text'>arrayForth notes Part 1</title><content type='html'>I haven't had a lot of time to work on my EVB001 eval board. &amp;nbsp;The time between sessions can go weeks and I tend to forget a lot of stuff. &amp;nbsp;These are notes to myself... sort of dead simple&amp;nbsp;exercises&amp;nbsp;to use as restart points. &amp;nbsp;So...&lt;br /&gt;&lt;br /&gt;Here is an example of just attaching to a node and getting it to do some computation. What you type into arrayForth is displayed in Courier font.&lt;br /&gt;&lt;br /&gt;First, you need to make sure a-com is set to the attached COM port.&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;a-com &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;i&gt;(this should display the com port number)&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;If the com port is incorrect, you must change it. &amp;nbsp;Do this:&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;def a-com &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;i&gt;(enter into the editor)&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;Navigate to the value, make the change, type &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;save &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;and exit/re-enter arrayForth.&lt;/span&gt;&lt;br /&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;(Hint: &amp;nbsp;Press ';' &amp;nbsp;to position the cursor just after the number; press 'n' to delete it; use 'u' to insert the new number; press ESC to leave that mode; press SPACE to exit editor and then type &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;save&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&amp;nbsp;)&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;Check the value again (&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;a-com&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;).&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;Now, let's go ahead and hook into node 600:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;host load panel &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;i&gt;(load host code and display the panel)&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-style: italic;"&gt;talk 0 600 hook upd &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;(talk to the chip, wire up to node 600 and update the stack view)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;You should now see a bunch of numbers on the stack, starting with line 3.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;Now, let's throw a couple of numbers onto the node's stack:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;7 lit 2 lit &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;i&gt;(lit pushes the numbers off of the x86 arrayForth stack and onto the node's stack)&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;You show now see 7 and 2 as the last two values on the 4th line.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;Remember, the stack display is in hex and the values you are entering is in decimal.&lt;br /&gt;(If you wish to enter values in Hex mode, press F1 and precede hex numbers with a zero (0).)&lt;br /&gt;&lt;br /&gt;Now, let's add the two numbers:&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;r+ &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;i&gt;(the "r" distinguishes the F18 addition word from the x86 "+" word)&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;You should now see 9 on top of the stack.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Simple.&lt;br /&gt;&lt;br /&gt;Now, let's try one more contrived&amp;nbsp;exercise. &amp;nbsp;Let's load some data into the node's RAM:&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;55 0 r! &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;i&gt;(take 2 values off of the x86 stack: &amp;nbsp;55 goes into location 0)&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;You won't see the changed memory until you type:&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;?ram&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;So, at last, we have something working "hands on". &amp;nbsp;The example in the arrayForth user guide is great, but sometimes a good start is to just to be able to interactively talk to the chip.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-7828869081196642622?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/7828869081196642622/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=7828869081196642622' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/7828869081196642622'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/7828869081196642622'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2011/11/arrayforth-notes-part-1.html' title='arrayForth notes Part 1'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-3469716117992928784</id><published>2011-11-20T10:21:00.001-05:00</published><updated>2011-12-20T23:38:01.772-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GreenArrays'/><title type='text'>Another GreenArrays blog</title><content type='html'>I've stumbled upon:&amp;nbsp;&lt;a href="http://greenarrays.blogspot.com/"&gt;http://greenarrays.blogspot.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Oh, and also, look to the right of this entry (under Links) for the permanent home of my arrayForth cheat sheet (just revised today).&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-3469716117992928784?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/3469716117992928784/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=3469716117992928784' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/3469716117992928784'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/3469716117992928784'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2011/11/another-greenarrays-blog.html' title='Another GreenArrays blog'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-1854644890805424759</id><published>2011-10-01T18:08:00.000-04:00</published><updated>2011-10-03T20:30:08.663-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GreenArrays'/><category scheme='http://www.blogger.com/atom/ns#' term='arrayForth'/><category scheme='http://www.blogger.com/atom/ns#' term='EVB001'/><title type='text'>GreenArrays arrayForth Keyboard cheat sheet</title><content type='html'>I'm having trouble wrapping my head around the arrayForth editor keyboard layout diagram in section 3.1 of the arrayForth user guide, so I am trying to put together a slightly modified version that more tightly associates the keyboard keys (and position) to function. &amp;nbsp;I am also dropping the grouping-via-color since I don't have a color printer at hand.&amp;nbsp;&amp;nbsp;Here is a link to the &lt;a href="http://www.maplefish.com/todd/arrayForthKeyboard.pdf"&gt;PDF&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-1854644890805424759?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/1854644890805424759/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=1854644890805424759' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/1854644890805424759'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/1854644890805424759'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2011/10/greenarrays-keyboard-cheat-sheet.html' title='GreenArrays arrayForth Keyboard cheat sheet'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-7047310624894004715</id><published>2011-09-27T19:38:00.002-04:00</published><updated>2011-10-03T20:30:30.522-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GreenArrays'/><category scheme='http://www.blogger.com/atom/ns#' term='arrayForth'/><category scheme='http://www.blogger.com/atom/ns#' term='EVB001'/><title type='text'>My GreenArrays EVB001 Eval Board Adventure</title><content type='html'>Okay, so I broke down and purchased an eval board last week. I got my shipment notice last Friday (which included a nice personal note from Greg Bailey mentioning that he saw my last blog &lt;a href="http://toddbot.blogspot.com/2011/09/greenarrays-g144-what-to-do-with-144.html"&gt;post&lt;/a&gt; -- thanks Greg) and the board arrived Monday.&lt;br /&gt;&lt;br /&gt;Now, to answer my own question (from that post): &lt;i&gt;What to do with 144 cores? &amp;nbsp;&lt;/i&gt;I guess I'm going to have to figure that one out...&lt;br /&gt;&lt;br /&gt;I've got a big learning curve ahead of me, and although I'm not the type to post daily updates on "learning experiences", I'll probably post now and then how it is going. If I get an overwhelming burst of energy, then I may even fork my EVB001 adventures to a new blog dedicated to just that.&lt;br /&gt;&lt;br /&gt;Anyway, what are my current plans?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Learn enough arrayForth (ColorForth) to be dangerous.&lt;/li&gt;&lt;li&gt;Work my way around the board (nodes and I/O).&lt;/li&gt;&lt;li&gt;Begin world dominating project.&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;Regarding #1, I have followed ColorForth for years, but I never really used it. &amp;nbsp;That being said, I am using Charley Shattuck's MyForth on my day job (shhh.. don't tell them) &amp;nbsp;and that is different enough from ANS Forths that the arrayForth "culture-shock" is low.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Working around the board (#2) is critical as I have to figure out what my peripheral hook up options are. &amp;nbsp;I figure that I would try and get the board talking to an accelerometer (or other sensor). This would be a good goal.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now, world domination (#3) is a bit vague.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now, here is what I am thinking.... My usual approach of building tiny/simple things that can be replicated (low volume production runs) won't work here. &amp;nbsp;I simply can't afford to dedicate a $450 eval board to a single task. &amp;nbsp;Then again, I hate the idea of just using it as a "prototyping" board for various ideas. &amp;nbsp;I need a more singular goal. &amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So, I am viewing the eval board as a "platform". &amp;nbsp;But, a platform for what?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;When someone (for passion) designs and builds their own car, plane or &lt;a href="http://microship.com/"&gt;boat&lt;/a&gt;, they are creating something unique. They are not making something with the end goal of mass production. They are building a "system" that satisfies their own needs. Now, if that "system" later results in replication due to demand, then that is great. But, it is all about building something unique -- something unlike the other guy's car, plane or boat.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You may see where I am getting... the usual place: Robotics.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;But, here I use the word "Robot" in loose terms. I am thinking about building a platform to support the integration of sensors and actuators. &amp;nbsp;I want to load up the EVB001 with as many sensors as possible and have it collect, correlate and react through the manipulation of actuators. &amp;nbsp;However, I want to do this within the tightest time constraint possible: I want a tight coupling between sensors and actuators. I want a feedback mechanism. I want... my flocking&amp;nbsp;&lt;a href="http://toddbot.blogspot.com/2011/05/ultrasonic-goslings-sensors-and.html"&gt;Goslings&lt;/a&gt;&amp;nbsp;(or at least one of them at this point).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Integrating lots of sensors with a single fast running ARM is certainly possible. But this would be interrupt hell (or polling hell or linux process/thread management hell). This is why I (and other sensible people) incorporate tiny 8051s, AVRs and MSP430s into dumb sensors -- to make them independently smarter. &amp;nbsp;Unfortunately, when you have a bunch of microcontroller enhanced sensors (and actuators) you have a communication nightmare. And you need a separate &lt;i&gt;master&lt;/i&gt;&amp;nbsp;CPU to integrate all of the "smart" data and manipulate the actuators.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;None of this is new. None of this is rocket science. However, the robot I design would be &lt;i&gt;my bot&lt;/i&gt;. It would be unique.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;More deep thoughts later... For now, I just need to figure out how to talk to my new toy ;-)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-7047310624894004715?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/7047310624894004715/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=7047310624894004715' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/7047310624894004715'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/7047310624894004715'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2011/09/my-greenarrays-evb001-eval-board.html' title='My GreenArrays EVB001 Eval Board Adventure'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-2205249799942689314</id><published>2011-09-19T21:13:00.000-04:00</published><updated>2011-10-03T20:30:30.519-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GreenArrays'/><category scheme='http://www.blogger.com/atom/ns#' term='arrayForth'/><category scheme='http://www.blogger.com/atom/ns#' term='EVB001'/><title type='text'>GreenArrays G144 - What to do with 144 cores?</title><content type='html'>I've been following the &lt;a href="http://greenarraychips.com/"&gt;GreenArrays&lt;/a&gt; G144 since its inception. &amp;nbsp;Now a &lt;a href="http://greenarraychips.com/home/products/index.html"&gt;kit&lt;/a&gt; is available... programmable in &lt;a href="http://www.colorforth.com/"&gt;colorforth&lt;/a&gt;&amp;nbsp;(and eforth). &amp;nbsp;Forth chips aren't new to me. I remember devouring the Novix NC4000 back in the mid-80s (I couldn't afford one...).&lt;br /&gt;&lt;br /&gt;So, the kit costs $450. I don't really have that kind of money to drop on a dev kit, but... if I did manage to scrape up the cash, what would I do with 144 computing cores?&lt;br /&gt;&lt;br /&gt;Seriously, that is a good question for deep thinking. From an embedded computing perspective, what could one do with 144 computing cores? &lt;br /&gt;&lt;br /&gt;If I can come up with some good ideas, this kit may be on my birthday wishlist.... ;-)&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-2205249799942689314?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/2205249799942689314/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=2205249799942689314' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2205249799942689314'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2205249799942689314'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2011/09/greenarrays-g144-what-to-do-with-144.html' title='GreenArrays G144 - What to do with 144 cores?'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-4632710334854472104</id><published>2011-09-09T15:30:00.000-04:00</published><updated>2011-09-09T15:30:05.647-04:00</updated><title type='text'>Smart Things</title><content type='html'>I want to design &lt;i&gt;Smart Things&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;Smart Things are small devices that do specific things to augment our own intelligence and abilities.&lt;br /&gt;&lt;br /&gt;A Smart Thing communicates with the outside world (and other external Smart Things) via protocols like NFC, Bluetooth or &amp;nbsp;TCP/IP.&lt;br /&gt;&lt;br /&gt;Co-located Smart Things may use SPI, I2C, UART or even bit banging GPIO.&lt;br /&gt;&lt;br /&gt;A Smart Thing is never too smart, although it should require very little human intervention. &amp;nbsp;It should be just smart enough to justify its own existence (as a gadget or parasitic module).&lt;br /&gt;&lt;br /&gt;A Smart Thing is usually energy efficient. It should run off of a battery or a host's power.&lt;br /&gt;&lt;br /&gt;Some examples of a Smart Things:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;A UV monitor that samples sunlight, calculates UV Index and can be queried through by an NFC Reader (like the Google Nexus S phone).&lt;/li&gt;&lt;li&gt;A motion detector that sends alerts through Bluetooth or Wi-Fi.&lt;/li&gt;&lt;li&gt;A light detector that keeps a log of when a room light has been turned on and for how long. It too could be queried through NFC.&lt;/li&gt;&lt;li&gt;Sensor modules for gardens. The Smart Things could measure soil moisture &amp;nbsp;and temperature. &amp;nbsp;They could pass the information on through Ant or Zigbee to another Smart Thing that collects and correlates the data (for collection via smart phone).&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;A Smart Thing should not be too expensive: The more, the merrier.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;A Smart Thing should last for at least 10 years (with at most 1 battery change per year) -- it should be embedded and "forgotten".&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;A really small Smart Thing could be built around a low power 8051 running MyForth or maybe an MSP430 running uForth/fil. &amp;nbsp;The point here being: You don't care what the platform is. &amp;nbsp;It just needs to work... and be smart.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-4632710334854472104?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/4632710334854472104/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=4632710334854472104' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4632710334854472104'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4632710334854472104'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2011/09/smart-things.html' title='Smart Things'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-1404659733413565059</id><published>2011-09-08T08:18:00.000-04:00</published><updated>2011-09-08T08:18:07.825-04:00</updated><title type='text'>Tethered Forths</title><content type='html'>In my last &lt;a href="http://toddbot.blogspot.com/2011/09/my-new-language-fil-forth-inspired.html"&gt;post&lt;/a&gt; I talk about writing my new language fil in uForth via 3 stage metacompilation.&lt;br /&gt;I want to note here that there is an alternate approach I am considering: &amp;nbsp;Tethering.&lt;br /&gt;&lt;br /&gt;I don't need to metacompile fil in order to get it running on a small MCU. If I retain the C code that does interpreting/compiling (bootstrap.exe) and write a new stripped down VM that doesn't understand interpreting/compiling (fil.exe), I only have to port the stripped down VM to the MCU. &amp;nbsp;I would do all of my development/compiling on the PC (with bootstrap.exe -- renamed pc-fil.exe). &amp;nbsp;The resulting byte code image (from compilation) would be moved to the MCU and run by the ported fil.exe.&lt;br /&gt;&lt;br /&gt;This approach is a subset of what uForth already does. &amp;nbsp;However, uForth also allows for the C based interpreter/compiler to run on the MCU. &amp;nbsp;This is a bit weighty, but essentially gives me the ability to interactively develop directly on the MCU (interacting through a serial interface).&lt;br /&gt;&lt;br /&gt;A better approach is tethering, and fil will prefer this approach even if I do re-implement the interpreter/compiler in uForth. &amp;nbsp;In tethering, you do your development on the PC (using fil.exe/bootstrap.exe) and craft a MCU VM that listens on a serial port for special "commands". &amp;nbsp;These commands can be as simple as "store byte-code" and "execute byte-code". You maintain a mirror of the dictionary between the PC and MCU. All the MCU VM needs to do (from an interaction perspective) is write PC compiled byte-code to its dictionary and to be able to execute it. No interpreter is needed.&lt;br /&gt;&lt;br /&gt;This is the brilliant method used by various Forths including &lt;a href="http://www.kiblerelectronics.com/kibler/MyForth_Reference_Manual.pdf"&gt;MyForth&lt;/a&gt;, and &lt;a href="http://pygmy.utoh.org/riscy/"&gt;Riscy Pygness&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;If I run into too many walls doing my 3 stages, I may take a break and just go tethered. I do have MCU CFT projects I want to get done!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-1404659733413565059?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/1404659733413565059/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=1404659733413565059' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/1404659733413565059'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/1404659733413565059'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2011/09/tethered-forths.html' title='Tethered Forths'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-8254584356646667199</id><published>2011-09-08T07:56:00.000-04:00</published><updated>2011-09-08T07:56:01.520-04:00</updated><title type='text'>My new language: fil  (Forth Inspired Language)</title><content type='html'>My last Forth was uForth. I wrote it to run on PCs (Linux, Cygwin, etc) and MCUs (TI MSP430 and any other Harvard architecture). &amp;nbsp;The implementation was a subset of ANSI and most of the Forth words were coded in Forth. &amp;nbsp;The interpreter, compiler and VM were coded in C.&lt;br /&gt;&lt;br /&gt;Since then, I've become (re)fascinated by more minimalistic Forths like ColorForth and MyForth. &amp;nbsp;uForth isn't a good playground for minimalistic experimentation, so I am writing a new Forth inspired language to be called fil. &lt;br /&gt;&lt;br /&gt;Like uForth, fil will work on small MCUs as well as big PCs. It will work on Harvard based memory architectures (separate flash/ROM and RAM address spaces) as well as the more familiar linear address space. &amp;nbsp;It will have a 16 bit instruction space (limited currently to a 64KB dictionary -- quite large in Forth terrms) and a 32 bit stack/variable cell size. &amp;nbsp; Using a 32 bit instruction space will force a trade off of code bloat (double the size of code) or speed/complexity (right now I used a switch based code interpreter that assumes each token is 16 bits). In the future I may silently upgrade to a 32 bit dictionary. &amp;nbsp;This shouldn't require a rewrite ;-)&lt;br /&gt;&lt;br /&gt;But, where do I start? &amp;nbsp;Well, uForth is a good place. &amp;nbsp;I figured I would bootstrap fil off of uForth. &amp;nbsp;In an ideal world (and ideal implementation of Forth), I would metacompile fil straight from uForth. &amp;nbsp;Unfortunately, there are some limitations/assumptions in the uForth C-based core. &amp;nbsp;So, instead, I am taking a hybrid approach of modifying the core (C) code and the uForth (Forth) code. &amp;nbsp;In essence, I am rewriting uForth to support metacompiling my new language (fil).&lt;br /&gt;&lt;br /&gt;Metacompiling is not new. It is a time honored Forth technique of building Forth from Forth. &amp;nbsp;However, while traditional metacompilers target machine code, I am targeting a strip down version of uForth's VM (bytecode interpreter).&lt;br /&gt;&lt;br /&gt;My approach is has three stages:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;1. I implement as much of uForth in Forth so that I can remove any underlying "C" assumptions and basically simplify the VM. &amp;nbsp;What I'll have left is a uForth/fil with the interpreter/compiler/VM written in C. &amp;nbsp;Let's call that C based executable "bootstrap.exe".&lt;br /&gt;&lt;br /&gt;2. &amp;nbsp;I rewrite the interpreter/compiler in uForth/fil.&lt;br /&gt;&lt;br /&gt;3. I submit the uForth/fil (Forth) source code to itself (the new interpreter/compiler) and produce a new byte code image.&amp;nbsp;&amp;nbsp;I can then strip the interpreter/compiler out of &amp;nbsp;the C code and produce a simple C VM that doesn't know squat about interpreting or compiling. &amp;nbsp;This new VM executable (fil.exe) and byte code image will be fil. &amp;nbsp; I no longer use "bootstrap.exe".&lt;br /&gt;&lt;br /&gt;After this, I can port the new VM to various MCUs.&lt;br /&gt;&lt;br /&gt;I have already finished Stage 1, but I reserve the option to spiral back in order to remove further C assumptions that prevent progress on Stage 2. &amp;nbsp;I am also not being very careful to retain full uForth backward compatibility. At the end of Stage 1 I already have a "hybrid" fi/uForth language.&lt;br /&gt;&lt;br /&gt;Once fil is complete, I will probably revisit the 16 bit dictionary and consider extending it to 32 bit. &amp;nbsp;If I do this, I don't want to break the idea of fil running on small (8/16 bit) MCUs efficiently. &amp;nbsp;I may consider a bank switched approach instead (multiple 16 bit dictionaries). &amp;nbsp;Don't forget: You can pack a lot of code into a 16 bit Forth!&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-8254584356646667199?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/8254584356646667199/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=8254584356646667199' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/8254584356646667199'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/8254584356646667199'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2011/09/my-new-language-fil-forth-inspired.html' title='My new language: fil  (Forth Inspired Language)'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-4653339403564144016</id><published>2011-08-29T08:14:00.000-04:00</published><updated>2011-08-29T08:14:50.867-04:00</updated><title type='text'>Software defined... Radio, GPS, ... etc?</title><content type='html'>Most comms modules (e.g. Bluetooth, GPS, etc), &amp;nbsp;memory peripherals (e.g. SD cards, USB sticks, etc) and other sophisticated "chips" have embedded processor cores. These cores may be based on stock 8051 or specialized ARM designs. &amp;nbsp;They are &lt;i&gt;smart&lt;/i&gt; devices that save system designers a lot of integration time by being "drop ins" (i.e. you talk with them via simple protocols over UART, I2C or SPI) and they do all of the hard work.&lt;br /&gt;&lt;br /&gt;Recently, reading about &lt;a href="http://en.wikipedia.org/wiki/Software-defined_radio"&gt;Software-defined Radios&lt;/a&gt;&amp;nbsp;(replacing hardware based tuning/filtering with software) and &lt;a href="http://www.technologyreview.com/web/20781/?mod=related"&gt;this&lt;/a&gt; article (dumber GPS modules where satellite correlation/fusion is done by back end computers), makes me wonder if the future will present dumber peripherals in trade for more processing on our main CPUs.&lt;br /&gt;&lt;br /&gt;How many processor cores are there in an average smart phone? You've got the primary CPU running the OS, but have you considered what is powering your Bluetooth, Wi-fi, GPS, cellular modem, display and touch interface? &amp;nbsp;Having sophisticated software in these peripheral chips certainly aids time to market (less programming for the integrator). &amp;nbsp;But, I rely on the craftiness of the chip designer to meet my needs.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Sure, its all software (even when on individual hardware modules), but rarely are these things upgradeable. They have a limited product life (even if the analog part of it is still relevant). &amp;nbsp;This is good for hardware companies, but not good for us (the end user/consumer). &amp;nbsp;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;I remember playing with early MEM accelerometer chips. They usually just output a voltage for an axis. There were no "interrupts" or SPI or I2C protocols. They were analog devices. It was up to me to figure out what they were spitting out and deal appropriately.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Now I use&amp;nbsp;&lt;i&gt;smart&lt;/i&gt;&amp;nbsp;digital accelerometers that notify me when an event (e.g. tilt, acceleration exceeding a threshold, free fall, tap, etc) occurs. Sometimes they can be frustrating if they don't quite provide what I need -- lots of register based tuning usually takes care of this, but still...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Imagine a smart phone where all of the processing was done on the main CPU. Sure, that would bog it down significantly, but imagine a much faster (and power efficient) main CPU (maybe even with 4 or 5 cores). &amp;nbsp;Now, your GPS/Bluetooth/Cellular-modem are just &amp;nbsp;analog transceivers that streams bits or analog signals. &amp;nbsp;Your smartphone would just have a bunch of antennas, transceivers and sensor hardware. All of the software resides somewhere on the main CPU.&lt;i&gt; Imagine having access to that software&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-4653339403564144016?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/4653339403564144016/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=4653339403564144016' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4653339403564144016'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4653339403564144016'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2011/08/software-defined-radio-gps-etc.html' title='Software defined... Radio, GPS, ... etc?'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-505780665326077712</id><published>2011-08-03T08:02:00.000-04:00</published><updated>2011-08-03T08:02:31.814-04:00</updated><title type='text'>UV Index monitor prototype #1</title><content type='html'>I don't know if I mentioned it here before, but I've been working on a personal UV (Index) monitor.&lt;br /&gt;Folks who have skin cancer (or those at high risk) need to make sure they limit their sun exposure.&lt;br /&gt;&lt;br /&gt;The general approach is to just lather up with sunscreen every time you leave the house, but this is impractical (plus you have to re-apply every couple of hours). &amp;nbsp;This becomes more of an annoyance when you consider spending hours riding in a car: Are the windows UV protected? How well? Do you have to lather up every time you drive?&lt;br /&gt;&lt;br /&gt;You can get UV index forecasts on your smartphone, but these are just forecasts (for your area and for the whole day). When you are out in the sun, you'll need to know how much UV intensity is hitting you &amp;nbsp;"right now".&lt;br /&gt;&lt;br /&gt;Another solution is to carry a UV monitor.&lt;br /&gt;&lt;br /&gt;The only ones I've seen on the market are &lt;a href="http://www.amazon.com/Oregon-Scientific-EB612-Personal-Exposure/dp/B000EPYMDW/ref=sr_1_1?ie=UTF8&amp;amp;qid=1312371214&amp;amp;sr=8-1"&gt;overkill&lt;/a&gt; (too large and complex) or &lt;a href="http://www.amazon.com/exec/obidos/ASIN/B004XMH9AK/emfpollutionsolu/"&gt;vague&lt;/a&gt;&amp;nbsp;(how does this work and is it reliable -- where is the sensor?)&amp;nbsp;.&lt;br /&gt;I am aiming at something so small that you'll always carry it with you, but also clear and as accurate as possible. &amp;nbsp;My target form factor is a key fob:&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://t1.gstatic.com/images?q=tbn:ANd9GcT-lb07NHS7_4YtDtXlLiRu5mOi7vhQlfZ4ShRzggwd4B6aG7jx" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="153" src="http://t1.gstatic.com/images?q=tbn:ANd9GcT-lb07NHS7_4YtDtXlLiRu5mOi7vhQlfZ4ShRzggwd4B6aG7jx" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;My target UI is based on colored LEDs. There are official colors for the UV index &lt;a href="http://www.epa.gov/sunwise/uviscale.html"&gt;scale&lt;/a&gt;&amp;nbsp;and I have an LED for each level. &amp;nbsp;I would like to have (at most) 2 buttons -- one for "instant read" (point at the sun and an LED will light up for 2 seconds indicating UV index level) and one for setting a countdown timer (for sunscreen re-application).&lt;br /&gt;&lt;br /&gt;My current prototype has 1 button, 5 high-intensity LEDs (green, yellow, orange, red and blue/violet) and is a little bulkier than a key fob. Amazingly, the LEDs are quite readable in bright sunlight! If you are colorblind you can always read index based on which LED lights up (right?). The current layout ramps "upwards" depending on UV intensity.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-aFDbPNuSjrU/Tjk23bb5UyI/AAAAAAAAAE4/TRufJFiVCH8/s1600/IMG_2667.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://2.bp.blogspot.com/-aFDbPNuSjrU/Tjk23bb5UyI/AAAAAAAAAE4/TRufJFiVCH8/s320/IMG_2667.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;It takes a single coin cell battery and is based on a very low power 8051 from SiLabs. It should get 3-5 years off the battery with casual usage.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-OaKpQdT4R5o/Tjk3OI9XPkI/AAAAAAAAAE8/ZcCYoxtf11o/s1600/IMG_2664.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://1.bp.blogspot.com/-OaKpQdT4R5o/Tjk3OI9XPkI/AAAAAAAAAE8/ZcCYoxtf11o/s320/IMG_2664.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;I need to do lots of tuning/calibration and I know it won't be "demo worthy" for the rest of this summer, but I am making progress. &amp;nbsp;Apparently, the calculations done for UV Index forecasting aren't very practical for small single UV sensors. Somehow, the personal UV monitors make due though. &amp;nbsp;I think I'll use one of the better ones to aid in my calibration.&lt;br /&gt;&lt;br /&gt;Maybe I'll have case design and a formal board spin ready for next summer?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-505780665326077712?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/505780665326077712/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=505780665326077712' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/505780665326077712'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/505780665326077712'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2011/08/uv-index-monitor-prototype-1.html' title='UV Index monitor prototype #1'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-aFDbPNuSjrU/Tjk23bb5UyI/AAAAAAAAAE4/TRufJFiVCH8/s72-c/IMG_2667.JPG' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-3245524469169741285</id><published>2011-07-15T07:44:00.000-04:00</published><updated>2011-07-15T07:44:12.497-04:00</updated><title type='text'>Tiny computers that fit on your fingernail...</title><content type='html'>Here is a thought: &lt;br /&gt;&lt;br /&gt;Pick up a &amp;nbsp;microSD card. &amp;nbsp;Place it on a fingernail. Look at how small it is. How much does it hold? 1GB? 2GB? 8GB? More? &amp;nbsp;Amazing. That is a lot of storage. These things are examples of how storage keeps shrinking while maintaining incredible capacity. You could fit a whole library on a microSD, right?&lt;br /&gt;&lt;br /&gt;But consider this: Inside all microSD cards lie an MCU core . (It may be an 8051. &amp;nbsp;The 8051 MCU is still a popular flash memory controller that you'll find in a majority of your USB thumb drives, SD and even (as a naked die) microSD cards.) &amp;nbsp;Each MCU contains some small amount of RAM too.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;So, &amp;nbsp;on your fingernail you have an 8 or 16 bit computer (typically running &amp;gt; 50Mhz) &amp;nbsp;with high speed I/O, RAM, gigabytes of persistent storage, and firmware that was probably written in C.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Mind blown.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-3245524469169741285?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/3245524469169741285/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=3245524469169741285' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/3245524469169741285'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/3245524469169741285'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2011/07/tiny-computers-that-fit-on-your.html' title='Tiny computers that fit on your fingernail...'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-2147757231367060563</id><published>2011-06-09T09:08:00.000-04:00</published><updated>2011-06-09T09:08:20.603-04:00</updated><title type='text'>Android: Bluetooth Low Energy vs USB</title><content type='html'>With all the &lt;a href="http://www.talkandroid.com/40391-google-announces-android-open-accessory-kit-for-developers/"&gt;hype&lt;/a&gt; about adding devices/peripherals to Android via USB, I desperately want a low energy wireless means of adding devices. A number of my (yet-to-be-started) CFT projects involve collecting sensor data for correlation/display on smart phones. &amp;nbsp;&lt;a href="http://www.thisisant.com/"&gt;ANT&lt;/a&gt; has always looked appealing, but with next to nothing in way of smartphone support, the new Bluetooth 4.0 &lt;a href="http://en.wikipedia.org/wiki/Bluetooth_low_energy"&gt;BLE&lt;/a&gt; support looks like it may capture the market.&lt;br /&gt;&lt;br /&gt;This year &lt;a href="http://vinnysoft.blogspot.com/2011/01/wednesday-april-7-2010-bluetooth-40-is.html"&gt;promises&lt;/a&gt; new Android devices with BLE. &amp;nbsp;On the peripheral/sensor front, we seem to have 2 major vendor choices: &lt;a href="http://www.nordicsemi.com/eng/Products/Bluetooth-R-low-energy"&gt;Nordic&lt;/a&gt; and &lt;a href="http://www.ti.com/ww/en/analog/bluetooth/index.htm?DCMP=BluetoothLowEnergy&amp;amp;HQS=NotApplicable+OT+bluetoothlowenergy"&gt;TI&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I'm not ready to drop money on a kit just yet, but my "body worn" sensor projects may get a kickstart knowing that a suitable means of data display is coming soon.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-2147757231367060563?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/2147757231367060563/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=2147757231367060563' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2147757231367060563'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2147757231367060563'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2011/06/android-bluetooth-low-energy-vs-usb.html' title='Android: Bluetooth Low Energy vs USB'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-7355929947774590285</id><published>2011-05-01T12:21:00.001-04:00</published><updated>2011-05-01T12:22:39.831-04:00</updated><title type='text'>Ultrasonic goslings: Sensors and software</title><content type='html'>I'm starting to get back into low level embedded systems. I'm back to see what 8-bits can do in a 64-bit world.&lt;br /&gt;&lt;br /&gt;Part of this reboot is to cast a fresh eye towards some of the sensor enhanced systems I've been mulling around for the past couple of years.&lt;br /&gt;&lt;br /&gt;In particular, I am re-investigating some ultrasonic tracking stuff. &amp;nbsp;In a nutshell, I want to to build a flock of robots (does 3 constitute a flock?) that will follow me around. Think: Mother goose and goslings.&lt;br /&gt;&lt;br /&gt;Imagine that you have an ultrasonic transmitter, attached to your belt, that transmits a short "beep" every second. &amp;nbsp;If your robots have 3 ultrasonic sensors each, then they can use hyperbolic positioning (Multilateration) to figure out where you are. &amp;nbsp;(The time difference between the 3 received beeps gives you direction; the receive time between each transmitted beep gives you distance).&lt;br /&gt;&lt;br /&gt;Now, every decent circuit I've seen for ultrasonic transducers tend to be fairly complex to build (mostly for clean amplification and rectification of the received signal). &amp;nbsp;Just throwing a transducer onto a (relatively) clean MCU with a sensitive ADC won't cut it. Or can it?&lt;br /&gt;&lt;br /&gt;We tend to want to put the cleanest, most linear signal into the ADC, but nature doesn't work that way. Nature uses a ton of error correction (software). &amp;nbsp;Even without perfectly working ears or eyes, the brain adapts to form a "picture".&lt;br /&gt;&lt;br /&gt;Given a noisy, weak, poorly rectified signal from an ultrasonic receiver, can software make sense of it?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-7355929947774590285?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/7355929947774590285/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=7355929947774590285' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/7355929947774590285'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/7355929947774590285'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2011/05/ultrasonic-goslings-sensors-and.html' title='Ultrasonic goslings: Sensors and software'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-4595466333007342504</id><published>2011-04-11T11:23:00.000-04:00</published><updated>2011-04-11T11:23:10.965-04:00</updated><title type='text'>Forth for ARM Cortex M3...</title><content type='html'>This &lt;a href="http://pygmy.utoh.org/riscy/cortex/#sec-1"&gt;news&lt;/a&gt; makes me happy :-)&lt;br /&gt;I should break out my old STM eval boards and give it a try.&lt;br /&gt;&lt;br /&gt;The last Forth (ignoring&amp;nbsp;&lt;a href="http://toddbot.blogspot.com/2011/03/uforth-dumpand-run.html"&gt;mine&lt;/a&gt;) that I've used was Charlie Shattuck's&amp;nbsp;&lt;a href="http://toddbot.blogspot.com/2010/08/myforth-8051-and-minimalism.html"&gt;MyForth&lt;/a&gt;. Well it looks like he has created a new MyForth for the Arduino crowd. Slide &lt;a href="http://www.forth.org/svfig/kk/02-2011-Shattuck.pdf"&gt;here&lt;/a&gt; and sources &lt;a href="http://www.forth.org/svfig/kk/02-2011-Shattuck.zip"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The nice thing about minimalism within the microcontroller world is that your end result is a "device". You don't have a lot of extra stuff (software standards, etc) to deal with.... so as long as your device interfaces correctly with outside world, the question is: Does it do something useful/interesting? Not: Did you use CouchDB, MongoDB or &lt;gasp&gt; SQL?&lt;/gasp&gt;&lt;br /&gt;&lt;br /&gt;Ah, the simple life.&lt;br /&gt;&lt;br /&gt;Also, a shout out to GreenArrays for releasing initial measurements in their&amp;nbsp;&lt;a href="http://www.greenarraychips.com/home/documents/greg/DB002-110411-G144A12.pdf"&gt;G144A12 spec sheet&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Ugh. I really need to find the time (and money) to play with the dev &lt;a href="http://www.greenarraychips.com/home/products/index.html"&gt;kit&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;/todd&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-4595466333007342504?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/4595466333007342504/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=4595466333007342504' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4595466333007342504'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4595466333007342504'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2011/04/forth-for-arm-cortex-m3.html' title='Forth for ARM Cortex M3...'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-228807796334680574</id><published>2011-04-10T16:54:00.000-04:00</published><updated>2011-04-10T16:54:55.961-04:00</updated><title type='text'>File under "Elegant": Factorial in Plan 9 rc (under Linux)</title><content type='html'>I've posted before that I find Plan 9's rc shell elegant. &amp;nbsp;I've been using a "slightly" modified (I've made read and echo builtins) version for a few months now and have been doing extensive scripting. I hope never to go back to bash.&lt;br /&gt;&lt;br /&gt;Here is a small script to compute factorials. Since "bc" deals with arbitrary precision, we can go much higher than the 32 or 64 bits.&lt;br /&gt;&lt;br /&gt;Chew on this:&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;#!/usr/local/plan9/bin/rc&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;fn fac {&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;num=0 factorial=1 frombc=$2 tobc=$3 {&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;for (num in `{seq $1}) {&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;echo $factorial '*' $num &amp;gt;$tobc&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;factorial=`{read &amp;lt;$frombc}&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;echo $factorial&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;fn fixlinebreaks {&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;awk -F '\\' '{printf("%s",$1)}&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt; $0 !~ /\\$/ {printf("\n"); fflush("");}'&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;fac $1 &amp;lt;&amp;gt;{bc | fixlinebreaks}&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There are several interesting things here:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Concurrent processing (co-processes actually).&lt;/li&gt;&lt;li&gt;Messaging through unix pipes.&lt;/li&gt;&lt;li&gt;Lazy computation (generator).&lt;/li&gt;&lt;/ol&gt;The last line launches bc as a coprocessing service (filtering output through fixlinebreaks which is needed due to a "feature" of bc where it breaks up long numbers into multiple lines -- blech). &amp;nbsp;We treat bc as a service and send it requests (steps in the factorial computation) and it responds with our intermediate results.&lt;/div&gt;&lt;div&gt;This factorial algorithm is iterative rather than recursive, but rather than using an incrementing counter loop, we generate all numbers using the 'seq' program and loop through that lazily generated list!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;How slow do you think this script will run? &amp;nbsp;Well on my Toshiba Portege r705 notebook with a Core i3, factorial of 1024 takes 2.4 seconds. Is that slow?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Earlier I said that I had enhanced rc with "echo" and "read" as builtins (normally they are external). Using the non-builtin "echo" and "read" increases the run time to 5.1 seconds.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Of course this isn't production code, but here is the take-away: "bc" gives you a bignum calculator for free. &amp;nbsp;Use it.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-228807796334680574?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/228807796334680574/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=228807796334680574' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/228807796334680574'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/228807796334680574'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2011/04/file-under-elegant-factorial-in-plan-9.html' title='File under &quot;Elegant&quot;: Factorial in Plan 9 rc (under Linux)'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-1128420096474054831</id><published>2011-03-14T20:23:00.000-04:00</published><updated>2011-03-14T20:23:03.835-04:00</updated><title type='text'>Tackling the Simple Problems: The domain of the minimalist</title><content type='html'>The hard problems are more interesting by nature and the world is full of hard problems. &amp;nbsp;This blog post isn't about them. Instead, I want to talk about simple problems.&lt;br /&gt;&lt;br /&gt;Simple problems are still problems, they just don't have world shaking impact (or so you would think).&lt;br /&gt;&lt;br /&gt;To be honest: most simple problems are only simple on the surface. &amp;nbsp;Underneath, complexity is always lurking.&lt;br /&gt;&lt;br /&gt;Take, for instance, my desire to (re)build a very simple blogging system (for my own personal use). &amp;nbsp;Blog software isn't all that hard to build. If you don't care about performance and scalability, then it is pretty straightforward. That is, until you get down to building one. As soon as you start thinking about security, feeds, multimedia, etc. &amp;nbsp;you start to expose the underlying complexity of "working" software.&lt;br /&gt;&lt;br /&gt;Now, as I said earlier, this is still something of a simple problem. Developing blogger software isn't rocket science. &amp;nbsp;But, in some ways, that makes it harder.&lt;br /&gt;&lt;br /&gt;When something is so simple (conceptually), it can be quite difficult to "get it right". &amp;nbsp;Getting it right is about hitting that sweet spot. Blogging software needs to do its simple job correctly and intuitively. If it is hard to install, or has "hard to grok"&amp;nbsp;idiosyncrasies, then it doesn't solve the "simple problem" of blogging.&lt;br /&gt;&lt;br /&gt;Consider another "simple problem". &amp;nbsp;I have around 40GB of music (mostly in MP3 format) that I want to play on my living room stereo (away from a computer). There are solutions I can buy, but none quite fit. I don't need streaming (although I would like to listen to online radio sometimes) and I don't need a "total entertainment solution". &amp;nbsp;I tend to listen to whole albums, not mixes or "randomized" selections based on genre.&lt;br /&gt;&lt;br /&gt;All I need is a single MP3 storage device, the ability to add/delete queued albums &amp;nbsp;from any of my household PCs (web browser NOT a hard requirement), and a simple "remote" (pause, play, next song, previous song). &amp;nbsp;What I want is a music "server" and it only has to serve one sound system. (Wi-fi streaming of music is broken in my house -- too much sporadic interference).&lt;br /&gt;&lt;br /&gt;There are server based (free!) software solutions out there, but they usually solve (only) 90% of my "simple problem". &amp;nbsp;They then throw UPnP, webservers, GUIs and all sorts of networking into the mix. &amp;nbsp;This is more than I want (after all I am a minimalist).&lt;br /&gt;&lt;br /&gt;Note: Before computers, my problem was solved 100% by a CD player w/ 200+ CDs and before that it was solved by vinyl LPs. &amp;nbsp;Now I have a bunch of MP3s and less capability to enjoy music than when I had CDs.&lt;br /&gt;&lt;br /&gt;Simple problems are harder than you think.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-1128420096474054831?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/1128420096474054831/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=1128420096474054831' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/1128420096474054831'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/1128420096474054831'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2011/03/tackling-simple-problems-domain-of.html' title='Tackling the Simple Problems: The domain of the minimalist'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-1597277445615483716</id><published>2011-03-14T20:21:00.000-04:00</published><updated>2011-03-14T20:21:34.856-04:00</updated><title type='text'>uForth Dump...and run</title><content type='html'>uForth has been mentioned here several times last year. It was my attempt at a very, very portable Forth (no dynamic memory allocation, ANSI C, &amp;nbsp;bytecode generator for portable images, etc). It has been run successfully on MSP430s as well as Windows/Linux. &amp;nbsp;No MSP430 code here unfortunately. I did most of the MSP430 code as part of my day job in 2010. It isn't mine to give away.&lt;br /&gt;&lt;br /&gt;However, you can get a dump of the generic ANSI code &lt;a href="http://www.maplefish.com/todd/uForth.tar.gz"&gt;here&lt;/a&gt;. &amp;nbsp;I haven't touched it in months and it needs documentation (and some general lovin'). &amp;nbsp;Unfortunately, I don't have access to MSP430s anymore and so that is left as an&amp;nbsp;exercise&amp;nbsp;for the reader :-(&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-1597277445615483716?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/1597277445615483716/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=1597277445615483716' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/1597277445615483716'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/1597277445615483716'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2011/03/uforth-dumpand-run.html' title='uForth Dump...and run'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-3874282763415949226</id><published>2011-03-07T21:14:00.000-05:00</published><updated>2011-03-07T21:14:10.073-05:00</updated><title type='text'>Notes on Mail header (and MIME) parsers...</title><content type='html'>I'm trying to resurrect my old gawk based blogging system &lt;a href="http://www.maplefish.com/todd/blognbox/"&gt;BLOGnBOX&lt;/a&gt;. It (ab)uses gawk to do everything from POP3 mail retrieval (you email your blog entry...) to FTP based posting of the blog (it is a static html blog).&lt;br /&gt;&lt;br /&gt;I intend on cleaning it up by doing away from the gawk abuses. I am either going to make it (Plan 9) rc based (with Plan 9 awk and some C for the networking) or perhaps Haskell. &amp;nbsp;That is quite a choice, eh?&lt;br /&gt;&lt;br /&gt;I've done a bit of Haskell over the past few months and feel strong enough to do the next generation BLOGnBOX, but the main problem is actually getting the thing going. (This is a nighttime CFT and, well, I have to get into a Haskell frame of thinking).&lt;br /&gt;&lt;br /&gt;The first task up is a parser for mime encoded email. I plan on using regular expressions (yes, I know -- use Parsec or something more Haskell-ish). &amp;nbsp;Awk is somewhat of a natural for this, but Gawk has a little more "oomph". &amp;nbsp;I can visualize how I would do it in Awk, but the Haskell is not coming naturally.&lt;br /&gt;&lt;br /&gt;Well, it isn't all that difficult to get started in Haskell:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;module MailParser where&lt;br /&gt;import Text.Regex&lt;br /&gt;import qualified Data.Map &amp;nbsp;as Map&lt;br /&gt;type Header = Map.Map String [String]&lt;br /&gt;header_regex = mkRegex "^(From|To|Subject)[ ]*:[ ]*(.+)"&lt;br /&gt;parseHeader :: String -&amp;gt; Header -&amp;gt; Header&lt;br /&gt;parseHeader s h = case matchRegex header_regex s&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; of Nothing -&amp;gt; h&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Just (k:v) -&amp;gt; Map.insert k v h&lt;/blockquote&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;Well, that is a beginning. Of course, I should be using ByteStrings for efficiency... &amp;nbsp;and, yes... I know... I know... I should be using Parsec&lt;br /&gt;&lt;br /&gt;/todd&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-3874282763415949226?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/3874282763415949226/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=3874282763415949226' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/3874282763415949226'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/3874282763415949226'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2011/03/notes-on-mail-header-and-mime-parsers.html' title='Notes on Mail header (and MIME) parsers...'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-2977568193221126695</id><published>2011-02-24T17:26:00.000-05:00</published><updated>2011-02-24T17:26:59.478-05:00</updated><title type='text'>Rc - Making shell scripting suck less</title><content type='html'>There are some tremendous ideas behind the&amp;nbsp;ubiquitous Unix shell (um, that would be Bourne, bash, (d)ash or maybe ksh?).&amp;nbsp;&amp;nbsp;The problem is that a lot of these ideas are very, very dated. &amp;nbsp;Bash is probably the best example of how to keep a Unix bourne dialect alive. Ksh was beastly (tons of features), but I think bash has finally passed it. &amp;nbsp;But is this a good thing?&lt;br /&gt;&lt;br /&gt;As I start writing more complex scripts I begin to feel the age of Bourne. &amp;nbsp;I have been using (d)ash (due to it being the Busybox shell and much smaller than bash -- GNU seem to be set on add the kitchen sink to every tool.) You can pretty much do general purpose scripting with Bash, but still with the legacy syntax of Bourne. You might as well go with Perl or Python (and their associated huge installation footprints).&lt;br /&gt;&lt;br /&gt;Then there is rc (the Plan 9 shell). It starts with Bourne and "fixes" things rather than tack on stuff around the edges. It is very minimalistic and has a certain elegance I haven't seen since Awk. &amp;nbsp;Plan 9's toolbox minimalism was an attempt to get back to the origins of Unix (lots of small single purpose tools). The famous anti-example of this is probably GNU ls. &amp;nbsp;Look at the options, the many, many options.&lt;br /&gt;&lt;br /&gt;Rc isn't actively supported much (Plan 9 has since faded -- if it ever shone brightly to begin with), but it has the feel of something well thought out.&lt;br /&gt;&lt;br /&gt;You'll hear more from me about that in upcoming posts.&lt;br /&gt;Time to shut up and code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-2977568193221126695?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/2977568193221126695/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=2977568193221126695' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2977568193221126695'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2977568193221126695'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2011/02/rc-making-shell-scripting-suck-less.html' title='Rc - Making shell scripting suck less'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-3314120351480297228</id><published>2011-02-21T08:13:00.001-05:00</published><updated>2011-02-21T08:43:24.140-05:00</updated><title type='text'>Exceptions and Errors in embedded systems</title><content type='html'>These past few posts have been ramblings to myself at the cusp of starting a new CFT (Copious Free Time) project. &amp;nbsp;I am weighing an "elegant" path (Haskell) vs a "Old Unix hacker" path (Shell scripts).&lt;br /&gt;&lt;br /&gt;While the Haskell approach is alluring, there is a lot of learning to do there and I am an "Old Unix hacker". &amp;nbsp;I am very familiar with the benefits of functional programming and have found the past 3 months doing Haskell (some on my day job) a lot of fun.&lt;br /&gt;&lt;br /&gt;But, I know I can get more accomplished sooner if I take a "Unix hacker" approach.&lt;br /&gt;&lt;br /&gt;Now, for the meat of this post (and an often arguing point against using shell scripts in critical environments): Safety.&lt;br /&gt;&lt;br /&gt;Or, more specifically, what about all of the points of unchecked failure in a shell script?&lt;br /&gt;Doesn't this betray the notion of an embedded system?&lt;br /&gt;&lt;br /&gt;Well, there is the dangerous situation of uncaught typos, but let's say we are real careful. How do we handle problems like:&lt;br /&gt;1. A process in the pipeline dies unexpectedly.&lt;br /&gt;2. The filesystem becomes 100% full.&lt;br /&gt;&lt;br /&gt;Interestingly, while something like "dd if=$1 | transform | gzip &amp;gt;$2" looks like it can be full of the above problems, I could argue that you have this problem using any programming language/approach.&lt;br /&gt;&lt;br /&gt;However, because it is so difficult to catch "exceptional" errors in the shell, it starts to make me wonder how I would handle this in a language that supports "exceptions".&lt;br /&gt;&lt;br /&gt;This is where things start to unravel (for me). &amp;nbsp;What do you do in that exception? How do you recover?&lt;br /&gt;Let's look at some approaches:&lt;br /&gt;&lt;br /&gt;1. Unix approach: &amp;nbsp; Wrap the "dd" line in a script and have a monitor start it, capture and log stderr and restart it if necessary (but not too aggressively -- maybe at some point give up and shutdown the system).&lt;br /&gt;2. Erlang approach: &amp;nbsp;Interestingly similar to above.&lt;br /&gt;3. Language w/ exceptions: Catch the error, close the files and.... um, restart?&lt;br /&gt;&lt;br /&gt;In the Unix approach, the cleanup is mostly done for you. Good fault tolerance practice (as suggested by Erlang) is pretty much handled by variants of init (I believe that daemontool's &lt;a href="http://cr.yp.to/daemontools/supervise.html"&gt;supervisor&lt;/a&gt;&amp;nbsp;has been doing this well for years).&lt;br /&gt;&lt;br /&gt;I am sure there are holes in my argument, but for my CFT, I am persisting all important data on disk (an event queue is central to my system). Every change (addition, execution, removal) of an event is an atomic disk transaction. If any process dies, it can be relaunched and pick up where it left off.&lt;br /&gt;&lt;br /&gt;For fault tolerant (embedded) systems I am not sure what I would do in an "exception" handler... outside of clean up and die.&lt;br /&gt;&lt;br /&gt;/todd&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-3314120351480297228?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/3314120351480297228/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=3314120351480297228' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/3314120351480297228'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/3314120351480297228'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2011/02/exceptions-and-errors-in-embedded.html' title='Exceptions and Errors in embedded systems'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-694255408534256854</id><published>2011-02-21T07:36:00.002-05:00</published><updated>2011-02-21T07:38:17.837-05:00</updated><title type='text'>Haskell scripting for robust embedded systems...</title><content type='html'>A convincing (unrelated) counter view to my prior posts here: &lt;a href="http://donsbot.wordpress.com/2010/08/17/practical-haskell/"&gt;Practical Haskell: scripting with types&lt;/a&gt;.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-694255408534256854?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/694255408534256854/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=694255408534256854' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/694255408534256854'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/694255408534256854'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2011/02/haskell-scripting-for-robust-embedded.html' title='Haskell scripting for robust embedded systems...'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-7929474036998086432</id><published>2011-02-20T15:57:00.000-05:00</published><updated>2011-02-20T15:57:46.956-05:00</updated><title type='text'>Unix Shell scripting for robust embedded systems</title><content type='html'>The summary/ramification of my previous post:&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Shell scripting (in this case Busybox) is a viable approach to developing robust, long running embedded systems.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you can afford to run a (multi-tasking, memory managed) Linux kernel in your embedded system and Busybox is there, then the shell (ash in this case) becomes a potential basis for a system architecture.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Of course, this is not breaking news. But I think it gets lost when we start taking a " single programming language" view of system development (as advocated by almost every modern programming language). &amp;nbsp;If you are trying hard to figure out how to get your favorite programming language to do what the shell does, then maybe it isn't the right tool for the job.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Sure, the "shell" isn't elegant and is full of pitfalls and gotchas when you use it beyond a couple of lines, but when your shell script starts to grow, you too should consider looking elsewhere for help (i.e. commands beyond what is built into the shell).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;An example: Don't get caught up in gawk/bash's ability to read from TCP sockets, leverage netcat (nc).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;/todd&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-7929474036998086432?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/7929474036998086432/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=7929474036998086432' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/7929474036998086432'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/7929474036998086432'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2011/02/unix-shell-scripting-for-robust.html' title='Unix Shell scripting for robust embedded systems'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-4488670026302528531</id><published>2011-02-20T15:45:00.000-05:00</published><updated>2011-02-20T15:45:39.201-05:00</updated><title type='text'>Haskell vs Busybox (for an embedded soft-realtime control system)</title><content type='html'>I'm building an embedded soft-real-time control system. It will handle sensor events and provide feedback to the user using voice synthesis.&lt;br /&gt;&lt;br /&gt;I really want to use Haskell for this CFT project, but I can get something running so much quicker by shell scripting. &amp;nbsp;There won't be a lot of sophisticated algorithms and I don't see scalability as a concern.&lt;br /&gt;&lt;br /&gt;When it comes down to it, I am find it harder and harder to do &lt;b&gt;system programming&lt;/b&gt; in a "programming language" vs something in a shell (with support from awk and friends). &amp;nbsp;It doesn't matter if it is C or Haskell, it starts to feel like (once again) re-inventing a wheel.&lt;br /&gt;&lt;br /&gt;As an example (and it has nothing to do with this current CFT project), consider this problem: I want to transform 1024 byte chunks of a file and write the results as a compressed file. The transformation doesn't matter, but let's say the transformation is written in C (or Haskell for that matter) and takes 50-100 ms per 1024 byte chunk.&lt;br /&gt;&lt;br /&gt;I want to do this task as fast as possible. I have (at least) 2 CPU cores to work with. &amp;nbsp;Let's look at two approaches:&lt;br /&gt;&lt;br /&gt;Approach A: &amp;nbsp;&amp;nbsp;Write a Haskell/C program to read 1024 bytes at a time, perform the translation, then the compression &amp;nbsp;and write the 1024 bytes to an output file.&lt;br /&gt;&lt;br /&gt;Okay, so I need to link in a decent gzip compression library and I use an appropriate "opt" parser to grab the input and output file. &amp;nbsp;Done.&lt;br /&gt;&lt;br /&gt;Approach B: &amp;nbsp;dd if=$1 bs=1024 | translator | gzip &amp;gt; $2&lt;br /&gt;&lt;br /&gt;This assumes that I write the same core "translator" code as above, so we can ignore that and focus on reading, compression and writing.&lt;br /&gt;&lt;br /&gt;You can guess which will take shorter to implement, but which is the more efficient?&lt;br /&gt;&lt;br /&gt;Well, my wild guess would be Approach B. Why? Well I already have a couple of things going for me. One is that I have automatic concurrency! While "dd" is just sitting there reading the disk, translator is running and gzip is also doing its thing. If I have 3 cores, then I have a good chance that each process can run in parallel (for at least a little while before they block). There is some cost in the piping, but that is something that linux/unix is optimized to perform. &amp;nbsp;Given that, "dd" has a good chance of causing more efficient file input buffering than my single threaded app in Approach A. The dd process has disk buffering + pipe buffering working for it so it may fetch (and dispatch) several 1024 byte chunks before it blocks on a full pipe. &amp;nbsp;A similar (but reverse) caching is happening with gzip too.&lt;br /&gt;&lt;br /&gt;So, you then consider rewriting Approach A but using a concurrency module/library. &amp;nbsp;Ugh. Let's not go there.&lt;br /&gt;&lt;br /&gt;So, if I take a scripting approach, my "controlling" part of the system can be written using the Shell and I can optimize to Haskell (or C) as needed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-4488670026302528531?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/4488670026302528531/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=4488670026302528531' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4488670026302528531'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4488670026302528531'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2011/02/haskell-vs-busybox-for-embedded-soft.html' title='Haskell vs Busybox (for an embedded soft-realtime control system)'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-2977624851357662672</id><published>2011-02-20T15:12:00.000-05:00</published><updated>2011-02-20T15:12:42.156-05:00</updated><title type='text'>The Wisdom of Unix shell scripting for systems</title><content type='html'>Prototype with Perl, Ruby, Python, Tcl, etc and to optimize you have to dive into using an FFI (foreign function interface).&lt;br /&gt;&lt;br /&gt;Prototype with a Unix/Linux shell (bash, ash, ksh, etc) and to optimize you rewrite proc/commands in your favorite (compiled?) language and use stdin/stdout as the interface.&lt;br /&gt;&lt;br /&gt;When piping makes sense (or concurrent processes with lightweight I/O requirements), 30+ years of shell wisdom is your friend.&lt;br /&gt;&lt;br /&gt;If shell scripts can be trusted to boot your Unix/Linux distribution, can the shell be trusted as the controller/glue for your application?&lt;br /&gt;&lt;br /&gt;/todd&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-2977624851357662672?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/2977624851357662672/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=2977624851357662672' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2977624851357662672'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2977624851357662672'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2011/02/wisdom-of-unix-shell-scripting-for.html' title='The Wisdom of Unix shell scripting for systems'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-2178521818019341332</id><published>2011-02-07T16:25:00.000-05:00</published><updated>2011-02-07T16:25:39.323-05:00</updated><title type='text'>Haskell Revelation -- Optimizing via refactoring</title><content type='html'>I have some code that lazily transforms a fairly large list of data (from an IO source) that must be search sequentially. Since it is lazy, the list isn't fully transformed until the first search. Since, I presume, a rather large stack of thunks are constructed instead, this first search takes a really, really long time. (It would be faster, I surmised, to strictly transform the list as it was being built, rather than lazily upon the first search).&lt;br /&gt;&lt;br /&gt;I started playing with `seq` but couldn't quite get the strictness right -- the code represented some of my first attempts at Haskell. &amp;nbsp;So, I decided to refactor the code (replace naive tail recursion with maps, filters, folds, etc). I figured at this point I would be able to see more clearly how to avoid the lazy list.&lt;br /&gt;&lt;br /&gt;Surprisingly, this refactoring was enough for the compiler to "do the right thing" and sped my application up&amp;nbsp;significantly. What was the compiling doing here? Did it remove the laziness? Or did it just optimize the hell out of what I thought was a lazy vs strict problem?&lt;br /&gt;&lt;br /&gt;/todd&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-2178521818019341332?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/2178521818019341332/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=2178521818019341332' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2178521818019341332'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2178521818019341332'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2011/02/haskell-revelation-optimizing-via.html' title='Haskell Revelation -- Optimizing via refactoring'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-5091823189666802430</id><published>2011-01-24T21:10:00.001-05:00</published><updated>2011-01-24T21:12:34.981-05:00</updated><title type='text'>How low can Haskell go? (Or what should I do with Haskell?)</title><content type='html'>Is Haskell a suitable language for programming robots? &amp;nbsp;Would a robot with a strictly functional brain be safer? &amp;nbsp;I have run a fairly hairy 2K line Haskell app on a target as small as an Atom based netbook. &amp;nbsp;It ran reasonably.&lt;br /&gt;&lt;br /&gt;I suppose, for a linux target, that a Haskell executable is pretty much like any other executable.&lt;br /&gt;&lt;br /&gt;What is the benefit to taking a purely functional approach to robotics?&lt;br /&gt;&lt;br /&gt;For some pioneers (think Greenblatt, Stallman, etc) Lisp was a "systems programming" language. Is Haskell a reasonable&amp;nbsp;successor?&lt;br /&gt;&lt;br class="Apple-interchange-newline" /&gt;These are questions I am pondering. &amp;nbsp;I am doing some Haskell (here an there -- prototyping stuff at work, etc), but I keep wondering what the killer application would be *for me*.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-5091823189666802430?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/5091823189666802430/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=5091823189666802430' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/5091823189666802430'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/5091823189666802430'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2011/01/how-low-can-haskell-go.html' title='How low can Haskell go? (Or what should I do with Haskell?)'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-5270593723912907334</id><published>2010-12-05T23:09:00.000-05:00</published><updated>2010-12-05T23:09:29.029-05:00</updated><title type='text'>Important techniques for (future) multi-core embedded development</title><content type='html'>These three approaches intrigue me: &amp;nbsp;&lt;a href="http://zwizwa.be/staapl/"&gt;Staapl&lt;/a&gt;, &lt;a href="http://www.google.com/url?sa=t&amp;amp;source=web&amp;amp;cd=2&amp;amp;ved=0CBwQFjAB&amp;amp;url=http%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fdownload%3Fdoi%3D10.1.1.122.6230%26rep%3Drep1%26type%3Dpdf&amp;amp;ei=LF38TLCJNYOdlgeJzoCMBQ&amp;amp;usg=AFQjCNFHCFFk18HVuCa6omSGlASRML7LBg"&gt;Lava&lt;/a&gt; and &lt;a href="http://www.kiblerelectronics.com/kibler/MyForth_Reference_Manual.pdf"&gt;MyForth&lt;/a&gt;. They don't address "multi-core embedded processors ", but I think their "meta system" approach will be integral in making it easier to developer for embedded multi-core controllers.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-5270593723912907334?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/5270593723912907334/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=5270593723912907334' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/5270593723912907334'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/5270593723912907334'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/12/important-techniques-for-future-multi.html' title='Important techniques for (future) multi-core embedded development'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-8573957479300266089</id><published>2010-11-23T21:37:00.000-05:00</published><updated>2010-11-23T21:37:13.521-05:00</updated><title type='text'>The Lonely Programmer (Hacker)</title><content type='html'>I've been noticing books on the market (and some blogs too) that speak of our newly emerging "Maker" culture -- a culture where people fed up with intangible abstract work (do you sit in a cubicle pushing numbers?) are turning to the gratification of hands on creation. They say that working on physical things can give you a deep sense of accomplishment that nurtures our primordial tool building minds.&lt;br /&gt;&lt;br /&gt;I put forth that some programmers can get this feeling from the intangible and abstract. &amp;nbsp;I grew up working with my hands (art, electronics, and just generally building stuff). &amp;nbsp;Programming became an extension of that. It my mind, my code held the same sense of accomplishment and gratification as building something with my hands. &amp;nbsp;I became enamored with virtual worlds!&lt;br /&gt;&lt;br /&gt;Nowadays, however, I find that a lot off programmers spend significant time worrying about languages, syntax, test coverage and code re-use. These are topics of varying importance, but they are just about honing your skills. &amp;nbsp;At some point you have to produce something. Hopefully it is beautiful (not just on the outside but inside too). &amp;nbsp;How you managed to create it (the language, test approach, etc) is secondary to the thing itself. And, oh, if it is malleable and can be adapted to do new exciting things, is that proof enough you used good coding techniques?&lt;br /&gt;&lt;br /&gt;We spend so much time talking about the tools, we forget that it is the result that matters. We forget about the joy and awe of working code. &amp;nbsp;We instead tend to form language advocacy groups, cult-like methodologies and obsess over software licensing.&lt;br /&gt;&lt;br /&gt;Really, if someone were to create a fully aware artificial being capable of not only passing the Turing test but able to engage us in deep conversation, would we (the programmers) nitpick over how poorly the code is structured, the lack of test coverage and how terrible it is that it was implemented in a crappy programing language?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-8573957479300266089?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/8573957479300266089/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=8573957479300266089' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/8573957479300266089'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/8573957479300266089'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/11/lonely-programmer-hacker.html' title='The Lonely Programmer (Hacker)'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-8148972944305355535</id><published>2010-11-11T15:50:00.001-05:00</published><updated>2010-11-11T16:45:03.792-05:00</updated><title type='text'>MP3 ID3v1 tag reading in Perl and in Haskell</title><content type='html'>I am building an MP3 jukebox for my home...&lt;br /&gt;&lt;br /&gt;I know that I am supposed to use ID3v2, but my MP3 collection (CD ripped, Amazon and Emusic) still sports ID3v1 tags, so I thought it would be a safe &amp;nbsp;bet to just parse it.&lt;br /&gt;&lt;br /&gt;I quickly wrote an ID3v1 tag parser in Perl (yes, I know CPAN has several solutions for this but I wanted to write my own just for the fun). Here is what it looks like:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;use strict;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;use warnings;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;use Fcntl qw(:seek);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;my @genre = (&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Blues','Classic Rock','Country','Dance',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Disco','Funk','Grunge','Hip-Hop',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Jazz','Metal','New Ag(e','Oldies',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Other','Pop','R&amp;amp;B','Rap',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Reggae','Rock','Techno','Industrial',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Alternative','Ska','Death Metal','Pranks',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Soundtrack','Euro-Techno','Ambient','Trip-Hop',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Vocal','Jazz+Funk','Fusion','Trance',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Classical','Instrumental','Acid','House',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Game','Sound Clip','Gospel','Noise',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'AlternRock','Bass','Soul','Punk',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Space','Meditative','Instrumental Pop','Instrumental Rock',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Ethnic','Gothic','Darkwave','Techno-Industrial',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Electronic','Pop-Folk','Eurodance','Dream',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Southern Rock','Cult','Gangsta','Top 40',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Christian Rap','Pop/Funk','Jungle','Native American',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Cabaret','New Wave','Psychadelic','Rave',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Showtunes','Trailer','Lo-Fi','Tribal',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Acid Punk','Acid Jazz','Polka','Retro',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Musical','Rock &amp;amp;','Hard Rock','Folk',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Folk-Rock','National Folk','Swing','Fast Fusion',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Bebob','Latin','Revival','Celtic',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Bluegrass','Avantgarde','Gothic Rock','Progressive Rock',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Psychedelic Rock','Symphonic Rock','Slow Rock','Big Band',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Chorus','Easy Listening','Acoustic','Humour',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Speech','Chanson','Opera','Chamber Music',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Symphony','Booty Brass','Primus','Porn Groove',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Satire','Slow Jam','Club','Tango',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Samba','Folklore','Ballad','Power Ballad',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Rhytmic Soul','Freestyle','Duet','Punk Rock',&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;'Drum Solo','A Capela','Euro-House','Dance Hall' );&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;my $id3v1;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;my $id3v1_tmpl = "A3 A30 A30 A30 A4 A28 C C C";&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;while (my $filename = &lt;stdin&gt;) {&lt;/stdin&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;chomp $filename;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;open my $fh, '&amp;lt;', $filename or next;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;binmode $fh;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;seek $fh, -128, SEEK_END and read $fh, $id3v1, 128;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;close $fh;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;my (undef,$title,$artist,$album,$year,$comment,undef,$trk,$genr) =&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;unpack($id3v1_tmpl,$id3v1);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;print "$filename|$title|$artist|$album|$year|$trk|".$genre[$genr]."\n";&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Basically it takes a stream of MP3 filenames over stdin, opens them and dumps out a pipe delimited summary of what it found. Here is how it is run:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;$ find /home/todd/music -name "*.mp3" | perl mp3info.pl &amp;gt;mp3_data.txt&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is a line from the output (mp3_data.txt):&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;/home/todd/music/Charles Mingus/Ah Um/Charles Mingus_10_Pedal Point Blues.mp3|Pedal Point Blues|Charles Mingus|Ah Um|1959|10|Jazz&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I am considering using Haskell for my jukebox, so I was curious what this would look like in Haskell. &amp;nbsp;Here is my &lt;i&gt;newbie&lt;/i&gt;&amp;nbsp;Haskell implementation:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;import Text.Printf&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;import Data.Array&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;import Char&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;import System.Environment&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;import System.IO&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;-- Create a array of genres&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;genres = listArray (0, l-1) genres_l&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; where&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; genres_l = [&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Blues", "Classic Rock","Country","Dance",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Disco","Funk","Grunge","Hip-Hop",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Jazz","Metal","New Age","Oldies",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Other","Pop","R&amp;amp;B","Rap",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Reggae","Rock","Techno","Industrial",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Alternative","Ska","Death Metal","Pranks",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Soundtrack","Euro-Techno","Ambient","Trip-Hop",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Vocal","Jazz+Funk","Fusion","Trance",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Classical","Instrumental","Acid","House",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Game","Sound Clip","Gospel","Noise",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "AlternRock","Bass","Soul","Punk",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Space","Meditative","Instrumental Pop","Instrumental Rock",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Ethnic","Gothic","Darkwave","Techno-Industrial",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Electronic","Pop-Folk","Eurodance","Dream",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Southern Rock","Cult","Gangsta","Top 40",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Christian Rap","Pop/Funk","Jungle","Native American",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Cabaret","New Wave","Psychadelic","Rave",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Showtunes","Trailer","Lo-Fi","Tribal",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Acid Punk","Acid Jazz","Polka","Retro",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Musical","Rock &amp;amp;","Hard Rock","Folk",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Folk-Rock","National Folk","Swing","Fast Fusion",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Bebob","Latin","Revival","Celtic",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Bluegrass","Avantgarde","Gothic Rock","Progressive Rock",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Psychedelic Rock","Symphonic Rock","Slow Rock","Big Band",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Chorus","Easy Listening","Acoustic","Humour",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Speech","Chanson","Opera","Chamber Music",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Symphony","Booty Brass","Primus","Porn Groove",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Satire","Slow Jam","Club","Tango",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Samba","Folklore","Ballad","Power Ballad",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Rhytmic Soul","Freestyle","Duet","Punk Rock",&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Drum Solo","A Capela","Euro-House","Dance Hall" ]&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; l = length genres_l&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;main = do&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;hSetEncoding stdin latin1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;hSetEncoding stdout latin1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;fname &amp;lt;- getContents &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-- lazily read list of files from stdin&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;mapM print_id3v1 (lines fname)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;print_id3v1 fname = do&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;print fname&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;inh &amp;lt;- openBinaryFile fname ReadMode&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;hSeek inh SeekFromEnd (-128)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;dat &amp;lt;- hGetContents inh&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;printf "%s|%s|%s|%s|%s|%d|%s\n"&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; fname&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; (extract 3 30 dat) &amp;nbsp; &amp;nbsp; &amp;nbsp;-- Title&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; (extract 33 30 dat) &amp;nbsp; &amp;nbsp; -- Artist&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; (extract 63 30 dat) &amp;nbsp; &amp;nbsp; -- Album&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; (extract 93 4 dat) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-- Year&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; (Char.ord (head (extract 126 1 dat))) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -- Track&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; (genres !(Char.ord (head (extract 127 1 dat)))) -- Genre&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;hClose inh&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;-- extract and trim a range of elements from list&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;extract idx ln s =&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;trim0 (take ln (drop idx s))&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;-- Trim nulls from list&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;trim0 s = filter (/= '\0') s&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;You run it&amp;nbsp;similarly. Frustratingly, it isn't very happy with filenames with non-ASCII characters :-(&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;$ find /home/todd/music/ -name "*.mp3" -print | ./mp3info &amp;gt;mp3_files.txt&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;mp3info: /home/todd/Music/music/Ch�ying Drolma &amp;amp; Steve Tibbetts/Selwa/Ch�ying Drolma &amp;amp; Steve Tibbetts_05_Gayatri.mp3: openBinaryFile: does not exist (No such file or directory)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I am not a Haskell expert, but I didn't expect it to choke there...&lt;br /&gt;&lt;br /&gt;EDIT: Fixed the filename problem by adding:&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;hSetEncoding stdin latin1&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;hSetEncoding stdout latin1&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-8148972944305355535?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/8148972944305355535/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=8148972944305355535' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/8148972944305355535'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/8148972944305355535'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/11/mp3-id3v1-tag-reading-in-perl-and-in.html' title='MP3 ID3v1 tag reading in Perl and in Haskell'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-3841771467381981948</id><published>2010-10-19T18:47:00.000-04:00</published><updated>2010-10-19T18:47:24.317-04:00</updated><title type='text'>Future runtime environment for Robots</title><content type='html'>Embedded systems are getting smaller and more sophisticated. While there are currently bare ARMs and 8/16-bit micros controlling our mainstream robots, this won't do for the more sophisticated (domestic) robots of the near future.&lt;br /&gt;&lt;br /&gt;When we consider sophisticated robots (whether ruled by a subsumption architecture or other invariably concurrent system), we won't think of Python, Java, Ruby or Perl. We will be thinking of something more Erlang-like or perhaps Unix-y.&lt;br /&gt;&lt;br /&gt;Can you imagine jacking into your robot's debug port, typing "ps" and seeing a collection of inter-communicating processes running on a Linux kernel? &amp;nbsp;Or will it be something like Erlang/OTP? &amp;nbsp;(Erlang is the dark horse here... Unix may never go away as a platform.)&lt;br /&gt;&lt;br /&gt;So, how about it? &lt;a href="http://www.erlang-embedded.com/"&gt;Erlang on a gumstix&lt;/a&gt;?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-3841771467381981948?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/3841771467381981948/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=3841771467381981948' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/3841771467381981948'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/3841771467381981948'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/10/future-runtime-environment-for-robots.html' title='Future runtime environment for Robots'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-1728833228468402456</id><published>2010-09-10T21:25:00.000-04:00</published><updated>2010-09-10T21:25:59.123-04:00</updated><title type='text'>New AFT release!</title><content type='html'>AFT development has dormant for about 1 year, so I decided to reboot it with a minor (experimental) release (5.098) that supports Indexing. This is mostly useful for LaTeX output. I'm not sure how useful the HTML output will be.&lt;br /&gt;&lt;br /&gt;I've also started to clean up the Perl source for AFT. &amp;nbsp;I am currently reading the new edition of &lt;a href="http://www.effectiveperlprogramming.com/"&gt;Effective Perl Programming&lt;/a&gt; and hope to apply more idiomatic Modern Perl conventions to the 14+ year old AFT sources.&lt;br /&gt;&lt;br /&gt;As always, AFT is available through "sudo apt-get install aft" under Ubuntu (and Debian?). But to get this new release, go to the AFT &lt;a href="http://www.maplefish.com/todd/aft.html"&gt;website&lt;/a&gt;. (For a quick look at Indexing in action, look at the aft reference &lt;a href="http://maplefish.com/todd/aft-refman.pdf"&gt;manual&lt;/a&gt; and scroll to the last page).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-1728833228468402456?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/1728833228468402456/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=1728833228468402456' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/1728833228468402456'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/1728833228468402456'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/09/new-aft-release.html' title='New AFT release!'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-2804990521467040596</id><published>2010-09-10T10:49:00.000-04:00</published><updated>2010-09-10T10:49:45.058-04:00</updated><title type='text'>I need to start archiving my art...</title><content type='html'>This is an airbrush I made 23 years ago:&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_b0Vq0XuF5vM/TIpE5l5ru4I/AAAAAAAAAC4/Ck641WQi7l8/s1600/miles.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="400" src="http://2.bp.blogspot.com/_b0Vq0XuF5vM/TIpE5l5ru4I/AAAAAAAAAC4/Ck641WQi7l8/s400/miles.png" width="312" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Miles Davis&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;I need to scan in all my old artwork and figure out the best place to post them.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-2804990521467040596?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/2804990521467040596/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=2804990521467040596' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2804990521467040596'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2804990521467040596'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/09/i-need-to-start-archiving-my-art.html' title='I need to start archiving my art...'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_b0Vq0XuF5vM/TIpE5l5ru4I/AAAAAAAAAC4/Ck641WQi7l8/s72-c/miles.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-7144119138785770352</id><published>2010-09-08T09:38:00.003-04:00</published><updated>2010-09-08T09:41:08.760-04:00</updated><title type='text'>I miss Perl...</title><content type='html'>I've been going through my old books and came upon a stash of Perl tomes. &amp;nbsp;I had a love/hate relationship with Perl. I wrote &lt;a href="http://www.maplefish.com/todd/aft.html"&gt;AFT &lt;/a&gt;in Perl, but have not used it as my language of choice in (almost) a decade.&lt;br /&gt;&lt;br /&gt;Stumbling across these books got me wondering: Where have all the Perl hackers gone?&lt;br /&gt;&lt;br /&gt;Well, I can't say where they have all gone (Ruby? Python? Retirement?), but I miss the funky vibe that Perl had in it's day. &amp;nbsp;Perl was messy, but the language attracted the most interesting people. &amp;nbsp;I've always seen it to be the language of &lt;i&gt;poets&lt;/i&gt; (as opposed to engineers). &amp;nbsp;Perl people loved wordplay. Perl people weren't just interested in producing interesting apps, but also making the app source code look&amp;nbsp;&lt;i&gt;interesting&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;Well, Perl isn't gone. Apparently, strides have been made in &lt;a href="http://perl6.org/"&gt;Perl 6&lt;/a&gt;&amp;nbsp;and &lt;a href="http://rakudo.org/"&gt;Rakudo &lt;/a&gt;is available for playing around with a lot of Perl 6 features. &lt;br /&gt;&lt;br /&gt;But, will the hackers come?&lt;br /&gt;&lt;br /&gt;I am reminded of a quote from &lt;a href="http://www.imdb.com/title/tt0382932/"&gt;Ratatouille &lt;/a&gt;(Colette introducing the kitchen staff to Linguine):&lt;br /&gt;&lt;blockquote&gt;&amp;nbsp;&lt;i&gt;"... So you see: We are Artists. Pirates. More than cooks are we."&lt;/i&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-7144119138785770352?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/7144119138785770352/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=7144119138785770352' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/7144119138785770352'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/7144119138785770352'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/09/i-miss-perl.html' title='I miss Perl...'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-4033426049385722253</id><published>2010-08-29T16:59:00.000-04:00</published><updated>2010-08-29T16:59:58.898-04:00</updated><title type='text'>Scratch, Squeak and so Forth: Robot programming enviroments</title><content type='html'>A thought experiment...&lt;br /&gt;&lt;br /&gt;If I was going to teach kids how to control a Roomba by way of programming, where would I start?&lt;br /&gt;Outside of Squeak and Scratch, I think the most common answer involves also teaching them how to use a source code editor.&lt;br /&gt;&lt;br /&gt;This is unacceptable.&lt;br /&gt;&lt;br /&gt;Squeak (as derived from Smalltalk-80) and Scratch (as derived from various Logos) integrates the programming environment with the language. This isn't about just being an "IDE". &lt;br /&gt;&lt;br /&gt;Squeak let's you hack in a workspace without concern for files. It is persistent and natural. You write a little, see how it works out and continue. &amp;nbsp;At some point you may save your workspace, but you aren't really thinking about files at this point. &lt;br /&gt;&lt;br /&gt;Scratch has a similar (although not as radical) approach. My youngest kids &amp;nbsp;(age 7 &amp;amp; 7) would script for a few hours and then pick some random series of characters as a "name" to save their project into (for later recovery). Eventually, they started using more descriptive words for naming their projects. But at no time did they think about files and file systems.&lt;br /&gt;&lt;br /&gt;I think files and editors are distractions (and not necessary ones -- unless you want to get a mainstream programming job).&lt;br /&gt;&lt;br /&gt;Forth had this idea decades ago (and so did Smalltalk). &amp;nbsp;Forth had blocks (1K blocks to be specific) that held text and data. The early bare-metal Forths used blocks as the single abstraction from persistent storage devices (disks). &amp;nbsp;Eventually, folks "enhanced" line oriented block editing with a visual screen (with single character cursor movement!).&lt;br /&gt;&lt;br /&gt;Forthers in the early 1980s (my self included) were happy.&lt;br /&gt;&lt;br /&gt;Now, in 2010, I face the prospect of teaching my oldest kid (age 12 -- expert Scratcher, beginning Python programmer) how to control a Roomba via programming that require the selection and mastery of files (and file systems) -- or at least some kind of file based IDE.&lt;br /&gt;&lt;br /&gt;Of the languages I have been looking at, Forth, Python and Lua are the front runners. &lt;br /&gt;&lt;br /&gt;I think Forth is a more natural fit. I have just downloaded &lt;a href="http://www.forthcommunity.com/viewtopic.php?f=9&amp;amp;t=38"&gt;VIBE&lt;/a&gt;&amp;nbsp;and I am being transported back 30 years. &amp;nbsp;I use to write (and extend) Forth editors like this. I am remembering how natural it felt to edit in blocks. (ColorForth continues this tradition, so Chuck Moore arguably never found much of an improvement in using file oriented environments ;-)&lt;br /&gt;&lt;br /&gt;Forth has always made me feel "closer to the machine". Plus, with a built-in editor, I am no longer doing the context switch being external editor and Forth. VIBE (or any other Forth Screen Editor) keeps me in Forth.&lt;br /&gt;&lt;br /&gt;I will be playing with VIBE under gforth (and perhaps extending it). &amp;nbsp;I am curious to see if this feeling is simply nostalgia or if my 23+ years of Emacs (w/ language editing modes) has been a bad move.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-4033426049385722253?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/4033426049385722253/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=4033426049385722253' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4033426049385722253'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4033426049385722253'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/08/scratch-squeak-and-so-forth-robot.html' title='Scratch, Squeak and so Forth: Robot programming enviroments'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-2093024185952279232</id><published>2010-08-24T12:12:00.001-04:00</published><updated>2010-08-29T17:01:15.109-04:00</updated><title type='text'>Greenspun's Tenth Rule adapted to Unix</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: sans-serif; font-size: 13px; line-height: 19px;"&gt;&lt;a href="http://en.wikipedia.org/wiki/Greenspun's_Tenth_Rule"&gt;Greenspun's Tenth Rule&lt;/a&gt;: &lt;i&gt;Any sufficiently complicated&amp;nbsp;&lt;/i&gt;&lt;i&gt;&lt;b&gt;C&lt;/b&gt;&lt;/i&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp;or&amp;nbsp;Fortran&lt;/b&gt;&amp;nbsp;&lt;b&gt;program &lt;/b&gt;contains an ad hoc, informally-specified,&amp;nbsp;bug-ridden, slow implementation of half of&amp;nbsp;&lt;b&gt;Common Lisp&lt;/b&gt;.&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px; line-height: 19px;"&gt;can be adapted to Unix:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px; line-height: 19px;"&gt;&lt;i&gt;Any sufficiently complicated&lt;b&gt; Perl, Python, Ruby, Lua, etc&lt;/b&gt;&amp;nbsp;&lt;/i&gt;&lt;i&gt;&amp;nbsp;&lt;b&gt;script &lt;/b&gt;contains an ad hoc, informally-specified,&amp;nbsp;bug-ridden, slow implementation of half of &lt;b&gt;Unix&lt;/b&gt;.&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px; line-height: 19px;"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px; line-height: 19px;"&gt;And I don't mean the all of the "system" calls. I mean: concurrency, fault tolerance, data persistence, configuration and scalability.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px; line-height: 19px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px; line-height: 19px;"&gt;It may be ugly, but combine ksh93/bash, awk, bc, etc (whatever you find on a standard Unix/Linux distro) and you'll find an analog to the features offered by the above mentioned languages. This does not include "abstractions" such as fancy data structures and other&amp;nbsp;syntactical&amp;nbsp;sugar.&amp;nbsp;&amp;nbsp; And, of course, fork/exec isn't going to beat a function call.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px; line-height: 19px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px; line-height: 19px;"&gt;However, (and this will be the subject of the next post), Unix under control of advanced shell (such as ksh93 or bash) can have the following capabilities (at least!):&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px; line-height: 19px;"&gt;Coroutines (Co-processes in ksh93 or recent Bash)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px; line-height: 19px;"&gt;Communicating Sequential Processes (CSP) via named pipes and co-processes&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px; line-height: 19px;"&gt;Dataflow processing (pipes)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px; line-height: 19px;"&gt;Arbitrary precision math (bc or other calculator)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px; line-height: 19px;"&gt;Reuse (command line apps)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px; line-height: 19px;"&gt;File (database) support (ls, awk, find, grep, sqlite command line, etc)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px; line-height: 19px;"&gt;List processing (command line args + ksh93/bash)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px; line-height: 19px;"&gt;Functions/apps as first class objects&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px; line-height: 19px;"&gt;And more...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px; line-height: 19px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-2093024185952279232?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/2093024185952279232/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=2093024185952279232' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2093024185952279232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2093024185952279232'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/08/greenspuns-tenth-rule-adapted-to-unix.html' title='Greenspun&apos;s Tenth Rule adapted to Unix'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-7983826484961188481</id><published>2010-08-21T17:21:00.000-04:00</published><updated>2010-08-21T17:21:36.022-04:00</updated><title type='text'>iRobot Create and Unix Programming</title><content type='html'>In my previous &lt;a href="http://toddbot.blogspot.com/2010/08/unix-as-programming-language-rethink.html"&gt;post&lt;/a&gt; I talked about using Unix as an embedded programming "language" (as opposed to a hosting environment for embedded apps).&lt;br /&gt;&lt;br /&gt;I started to think about where to begin. &amp;nbsp;Well, let's consider the iRobot Create platform (Roomba too!).&lt;br /&gt;Between your controller and the iRobot is a serial port and a binary command protocol.&lt;br /&gt;If I wrote a small C app to talk over the serial port and convert to/from binary and text, I can utilize the Unix pipeline for some further down app that reads the robot's binary response as newline delimited text data.&lt;br /&gt;For example:&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;echo "get sensors" | irobot-oi /dev/ttyS0 | some-later-app&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;The "irobot-oi" open "/dev/ttyS0", takes text commands as input ("get sensors"), converts it to an iRobot OI binary request, sends it, reads the binary response and converts it to text for "some-later-app". &amp;nbsp;This app could be written in C, awk, perl, etc.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;This approach is so obvious that I would be shocked to learn that no one has tried it. &amp;nbsp;I know there are libraries available the iRobot Open Interface (OI) in python and other languages, but is there a Unix command line available?&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;From a traditionalist Unix position, "irobot-oi" is actually doing too much. &amp;nbsp;You'd have to encode mappings between each binary command/response byte/bit and text. &amp;nbsp;A more minimal approach would be to write an even simpler binary/text converter that simply understands the protocol encapsulation and accepts/emits a comma delimited representation of the binary data. (Since the OI response protocol is directly dependent on request -- there are varying length responses with no terminator -- we have to develop some smarts into the converter.)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;So, instead we would have something like this:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;echo "142,2,9,13" | irobot-oi-cvt /dev/ttyS0 | some-later-app&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;The above command requests the state of the left cliff sensor (9) and the virtual wall detector (13) and sends the result (in comma delimited text) to "some-later-app" (which may do the actual english text mapping or simply react to the numbers).&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-7983826484961188481?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/7983826484961188481/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=7983826484961188481' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/7983826484961188481'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/7983826484961188481'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/08/irobot-create-and-unix-programming.html' title='iRobot Create and Unix Programming'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-3263704438660969069</id><published>2010-08-21T14:57:00.000-04:00</published><updated>2010-08-21T14:57:42.367-04:00</updated><title type='text'>Unix as a Programming Language - Rethink Embedded Scripting (and CSP)</title><content type='html'>As I look at eLua (on an &lt;a href="http://mbed.org/"&gt;mbed&lt;/a&gt; for one of my robot projects), my mind wanders... have I stumbled into another monolithic system approach?&lt;br /&gt;&lt;br /&gt;eLua embedded systems are Lua and (maybe) some C. &amp;nbsp;I like Lua, but am I just trading one language ( Forth, C, etc) for another?&lt;br /&gt;&lt;br /&gt;This line of thinking keeps bringing me back to Unix. Under (traditional) Unix, I have a multi-process environment connected by pipes. &amp;nbsp;I choose the appropriate language (or existing app) for the task at hand and glue it together with a shell.&lt;br /&gt;&lt;br /&gt;Now, this would (most likely) be overkill for a small embedded device, especially in regards to power consumption. But, assume for the moment, that I had all of the Unix resources at hand and didn't concern myself with power consumption. &amp;nbsp;What would my robot controller design look like?&lt;br /&gt;&lt;br /&gt;I design and build GPS trackers during the day. I use C and (sometimes) Forth. &amp;nbsp;I've thought about eLua, but I'd still have to write a NMEA sentence parser and fencing algorithm in a language not necessarily perfect for parsing.&amp;nbsp;&amp;nbsp;How would I go about doing this if I had awk at my disposal? Or grep/sed? Or... the whole unix environment tied together with pipes under a shell. &amp;nbsp;Would something like &lt;a href="http://www.busybox.net/"&gt;BusyBox&lt;/a&gt; be a good foundation?&lt;br /&gt;&lt;br /&gt;What is the smallest MCU (or embedded SBC) that I could run something like &lt;a href="http://en.wikipedia.org/wiki/%CE%9CClinux"&gt;uCLinux&lt;/a&gt; and BusyBox on?&lt;br /&gt;Could I do development under a fairly modest laptop Linux and port down to uCLinux and BusyBox?&lt;br /&gt;&lt;br /&gt;Right now I am looking (again) at &lt;a href="http://en.wikipedia.org/wiki/Communicating_sequential_processes"&gt;CSP&lt;/a&gt; (perhaps built upon Lua co-routines) as a mechanism for architecting embedded systems that integrate multiple (sensor) inputs. &amp;nbsp;You can also build CSP upon Unix processes (and pipes). This is the way I've done it for 25+ years. &amp;nbsp;Do I really need to cast my architecture into another &lt;a href="http://lambda-the-ultimate.org/node/1210"&gt;monolith&lt;/a&gt;?&lt;br /&gt;This is just me bring up &lt;a href="http://lambda-the-ultimate.org/node/1282"&gt;Unix as a Programming Language&lt;/a&gt; again (but this time under the constraints of embedded computing)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-3263704438660969069?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/3263704438660969069/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=3263704438660969069' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/3263704438660969069'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/3263704438660969069'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/08/unix-as-programming-language-rethink.html' title='Unix as a Programming Language - Rethink Embedded Scripting (and CSP)'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-7300557531178701907</id><published>2010-08-11T08:47:00.001-04:00</published><updated>2010-08-11T08:48:22.531-04:00</updated><title type='text'>Resurrecting BLOGnBOX</title><content type='html'>I've been thinking about resurrecting my gawk based blogging system &lt;a href="http://www.maplefish.com/todd/blognbox/"&gt;BLOGnBOX&lt;/a&gt;. &amp;nbsp;I am getting tired of Blogger.&lt;br /&gt;&lt;br /&gt;While BLOGnBOX doesn't have as many features, it lets me focus on what I want from a blog. &amp;nbsp;Although this has changed over time, I think what I currently want is:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;A way to&lt;i&gt;&amp;nbsp;publish&lt;/i&gt;&amp;nbsp;my thoughts and ideas.&lt;/li&gt;&lt;li&gt;An archive of my thoughts and ideas.&lt;/li&gt;&lt;li&gt;A primary means of writing.&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;I am less concerned with the &lt;i&gt;web&lt;/i&gt;&amp;nbsp;aspects of a blogging system. &amp;nbsp;I'd like to have a clean, simple (yet elegantly presented) blog that I can tinker with as needed.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;What led me down this path of thought is the desire to extract blog entries (or the whole blog) as a PDF document. By PDF, I really mean LaTeX or TeX quality (not just a dump). &amp;nbsp;AFT does this for me, but it might be overkill for a blogging system. Perhaps the next iteration of BLOGnBOX should &amp;nbsp;leverage LaTeX directly?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;And, of course, the next iteration should be composed as a &lt;a href="http://www.literateprogramming.com/"&gt;Literate Program&lt;/a&gt;! &amp;nbsp;(I'm leaning towards &lt;a href="http://www.cs.tufts.edu/~nr/noweb/"&gt;Noweb&lt;/a&gt;.)&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-7300557531178701907?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/7300557531178701907/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=7300557531178701907' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/7300557531178701907'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/7300557531178701907'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/08/resurrecting-blognbox.html' title='Resurrecting BLOGnBOX'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-2649464564414787435</id><published>2010-08-04T19:05:00.001-04:00</published><updated>2010-08-04T19:07:03.540-04:00</updated><title type='text'>Humans were not meant to...</title><content type='html'>Humans were not meant to sit in cubicles.&lt;br /&gt;Humans were not meant to spend 8 hours a day working on reports and clicking aimlessly on the web to relieve the tedium.&lt;br /&gt;Humans were not meant to be imprisoned by a workforce that wants you to do repetitive tasks mindlessly.&lt;br /&gt;&lt;br /&gt;Humans are meant to be adventurous and creative, with bursts of brilliance (whether through exuberant play or hard knuckled persistence).&lt;br /&gt;Children understand this.  As adults we unlearn this.  We are taught to work hard, conform for the good of society, buy a house, put away money into a 401K and make a stable environment for raising our kids.  We are taught to be "wage slaves".&lt;br /&gt;&lt;br /&gt;Sadly, most humans will never break free. But that makes it even more important that you become that rare exception (at least for a while). You have a duty to be brilliant, exuberant and adventurous. Laugh hard, fight injustice (aka stupidity), be creative and kind.&lt;br /&gt;&lt;br /&gt;Be passionate. Don't be afraid to piss off people. Sometimes people need to be shook up.&lt;br /&gt;&lt;br /&gt;Draw, paint, dance, program -- set an example for your kids. Let them know that it isn't their duty to conform, accept the status quo or "work for the weekend".  The best thing you can do for your kids is to show them what it means to be free -- to be truly human. Brilliant, volatile and utterly unique. Take chances. (You don't have to quit your job to do this.) Just do something to express your joy, your uniqueness, your value as a human.&lt;br /&gt;&lt;br /&gt;F*ck your boss. No, not that person you report to at work. Your real boss: the mental shackles that keeps you "in line".  Break those shackles.&lt;br /&gt;&lt;br /&gt;Not everyone can do this. But it is your duty to try.&lt;br /&gt;&lt;br /&gt;Sometimes, when your boss isn't looking... let &lt;a href="http://knowyourmeme.com/i/000/061/695/original/RV7ie.jpg?1280097482"&gt;go&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-2649464564414787435?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/2649464564414787435/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=2649464564414787435' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2649464564414787435'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2649464564414787435'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/08/humans-were-not-meant-to.html' title='Humans were not meant to...'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-805203862407102633</id><published>2010-08-04T18:32:00.000-04:00</published><updated>2010-08-04T18:32:02.647-04:00</updated><title type='text'>Myforth, 8051 and minimalism</title><content type='html'>Programming in Myforth has given me a greater appreciation for minimalism. &amp;nbsp;(I suppose programming in ColorForth would be even better, but I don't have access to the proper hardware...)&lt;br /&gt;&lt;br /&gt;Using minimalistic (simple) tools forces you to approach a problem differently. &amp;nbsp;I felt some of this back in the 80's when all I had was a little Commodore 64 and some big ideas, but coming back to minimalism from two decades of big iron is refreshing.&lt;br /&gt;&lt;br /&gt;I now look at a problem and think "what is the simplest way to solve this?". &amp;nbsp;This takes on a deeper meaning when you consider that the tools force you to find simpler ways. When all you have is 768 bytes of RAM and 8KB of flash, you have to think in simple terms.&lt;br /&gt;&lt;br /&gt;Take, for instance, the problem of geofencing. &amp;nbsp;I do GPS trackers (on 16-bit micros) for my day job. &amp;nbsp;I have an MSP430, 16KB of RAM and 256KB of program space (flash). &amp;nbsp;The trackers I build have a concept called geofencing. Here you define polygons or circles that affect how the GPS points are handled. Sometimes you want to log at a different rate based on the fence you are in; sometimes you want to "beacon" (transmit) at a different rate.&lt;br /&gt;&lt;br /&gt;Programming a fence algorithm can be tricky (and computationally intensive). In addition, GPS coordinates are represented typically in (at least) scaled 32 bit values (w/ 5 decimal digit precision).&lt;br /&gt;&lt;br /&gt;Thirty-two bit math is taxing for an MCU that only supports 8-bit math.&amp;nbsp;What is a lowly 8-bit to do? &lt;br /&gt;Well, if your "problem domain" only needs to deal with fences defined around just a few miles, you can truncate a lot of the math to 16 (or fewer) bits while retaining precision. Once you know that you are "in the ball park", you only need to look at the lower bits. &amp;nbsp;You don't need to consider the whole 32 bits.&lt;br /&gt;&lt;br /&gt;This is a good example of how refining the problem domain helps generate a simpler (smaller) solution. Even if I used 16 bit or 32 bit MCUs, this can save me some processing time. (My field is "low power consumption" solutions, so saving processing time equals saving power).&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-805203862407102633?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/805203862407102633/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=805203862407102633' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/805203862407102633'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/805203862407102633'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/08/myforth-8051-and-minimalism.html' title='Myforth, 8051 and minimalism'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-6164441744089585206</id><published>2010-07-20T19:41:00.000-04:00</published><updated>2010-07-20T19:41:46.535-04:00</updated><title type='text'>myforth, 8051 and robotics</title><content type='html'>Just an update. I am quite taken by Charley Shattuck's&amp;nbsp;&lt;a href="http://www.kiblerelectronics.com/kibler/forth.shtml"&gt;myforth&lt;/a&gt;&amp;nbsp;(click link and scroll to the bottom of the page).&amp;nbsp;Porting it to an obscure 8051 &lt;a href="http://www.silabs.com/products/mcu/mixed-signalmcu/Pages/C8051F35x.aspx"&gt;part&lt;/a&gt; &amp;nbsp;(for &amp;nbsp;24 bit sigma-delta ADC) greatly increased my knowledge of 8051 assembly. Myforth is more of a Forth-based macro-assembler than a Forth dialect. It is both minimalistic and rich.&lt;br /&gt;&lt;br /&gt;I got great pleasure out of implementing a moving average over 24 bit ADC samples using just 8-bit operators for the math. &amp;nbsp;It reminds me that I take a lot for granted when I toss about 32 bit integers using C on an MCU.&lt;br /&gt;&lt;br /&gt;(I've previously used SwiftX Forthfor 8051 programming, but the part in question had only 768 bytes of RAM -- not quite enough.)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-6164441744089585206?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/6164441744089585206/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=6164441744089585206' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/6164441744089585206'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/6164441744089585206'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/07/myforth-8051-and-robotics.html' title='myforth, 8051 and robotics'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-6837402549906661642</id><published>2010-06-06T15:23:00.001-04:00</published><updated>2010-06-06T15:23:19.288-04:00</updated><title type='text'>Ideas are dangerous things...</title><content type='html'>A movement starts with an idea. A revolution starts with an idea. An invention starts with an idea.&lt;br /&gt;Ideas are volatile things.&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: verdana, arial, helvetica; font-size: 11px;"&gt;&lt;i&gt;...There are thoughts enough&lt;br /&gt;To blow men’s minds and tear great worlds apart&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;/blockquote&gt;&amp;nbsp;My thoughts were in embedded systems for the past 4 years. &amp;nbsp;Four years ago I left behind large systems development. &amp;nbsp;I went minimal -- 8-bits in fact. &amp;nbsp;Improbable as it seems, I managed to get back into Forth development. I've spent the last 8 months writing Forth code on a 16-bit MCU (MSP430). &amp;nbsp;The project is ending and the product is about to be delivered.&lt;br /&gt;&lt;br /&gt;My thoughts now turn to vacation. &amp;nbsp;But, once on vacation, my thoughts will wander back to computers. So, what's next?&lt;br /&gt;&lt;br /&gt;I'd like to finish my embedded system CFT projects, but of course, my mind wanders.&lt;br /&gt;&lt;br /&gt;My mind is wandering &lt;a href="http://www.racket-lang.org/"&gt;here&lt;/a&gt; &amp;nbsp;and &lt;a href="http://www.bootstrapworld.org/"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;A while back, I read (and mentioned) &amp;nbsp;&lt;a href="http://www.amazon.com/exec/obidos/ASIN/1929470053/nomadicrese0c-20"&gt;Reaching Escape Velocity&lt;/a&gt; (and &lt;a href="http://microship.com/resources/gonzo-engineering.html"&gt;Gonzo Engineering&lt;/a&gt;). &amp;nbsp;Steven Roberts suggests that you find your all consuming project and pursue it. &lt;br /&gt;&lt;br /&gt;The problem is, I don't have such a project in mind.&lt;br /&gt;Maybe my true passion isn't &lt;i&gt;making things&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;I love ideas. &amp;nbsp;I think I am a programmer (rather than inventor) because I often don't need to &lt;i&gt;build&lt;/i&gt;&amp;nbsp;something. Sometimes it is just enough to &lt;i&gt;think&lt;/i&gt;&amp;nbsp;it (and most importantly &lt;i&gt;share&lt;/i&gt;&amp;nbsp;it). &amp;nbsp;Ideas are like.&lt;br /&gt;&lt;br /&gt;So, I am not sure what I am going to do next.&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: verdana, arial, helvetica; font-size: 11px;"&gt;&lt;i&gt;So whatever your hands find to do&lt;br /&gt;You must do with all your heart&lt;br /&gt;There are thoughts enough&lt;br /&gt;To blow men’s minds and tear great worlds apart&lt;br /&gt;&lt;br /&gt;There’s a healing touch to find you&lt;br /&gt;On that broad highway somewhere&lt;br /&gt;To lift you high&lt;br /&gt;As music flying&lt;br /&gt;Through the angel’s hair.&lt;br /&gt;&lt;br /&gt;Don’t ask what you are not doing&lt;br /&gt;Because your voice cannot command&lt;br /&gt;In time we will move mountains&lt;br /&gt;And it will come through your hands&amp;nbsp;&amp;nbsp;-- John Hiatt, "Through Your Hands"&lt;/i&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-6837402549906661642?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/6837402549906661642/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=6837402549906661642' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/6837402549906661642'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/6837402549906661642'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/06/ideas-are-dangerous-things.html' title='Ideas are dangerous things...'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-7070149452937625980</id><published>2010-06-04T18:43:00.000-04:00</published><updated>2010-06-04T18:43:58.097-04:00</updated><title type='text'>Posterous... BLoGnBOX</title><content type='html'>I stumbled upon Posterous and it sounds a bit like my &lt;a href="http://www.maplefish.com/todd/blognbox/#1153537482-8362"&gt;BLoGnBOX&lt;/a&gt;.&lt;br /&gt;Posterous came out in 2008; BLoGnBOX went live in 2006.&lt;br /&gt;&lt;br /&gt;BLoGnBOX was never hosted but the concept is the same: Email to Blog posting.&lt;br /&gt;&lt;br /&gt;Posterous recently announced Markdown &lt;a href="http://blog.posterous.com/announcing-markdown-support"&gt;support&lt;/a&gt;.&lt;br /&gt;Markdown is very similiar to my own &lt;a href="http://www.maplefish.com/todd/aft.html"&gt;AFT&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-7070149452937625980?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/7070149452937625980/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=7070149452937625980' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/7070149452937625980'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/7070149452937625980'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/06/posterous-blognbox.html' title='Posterous... BLoGnBOX'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-7416299008125338181</id><published>2010-06-02T15:14:00.002-04:00</published><updated>2010-06-02T15:16:33.965-04:00</updated><title type='text'>WikiReader Data Logger</title><content type='html'>A quick hack. Here is a data logger I wrote for the WikiReader that I use at work. It uses my previously discussed WikiReader Serial port hack:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;160 constant max-line-chars&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;variable byte&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;create line-buf max-line-chars chars allot&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;variable lbcnt&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;variable fd&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;variable linecnt&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;\ Base logfile&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;\&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;: logfile s" log.000" ;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;\ Create a new logfile with new 3 digit numeric extension&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;\ (e.g. log.001)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;\&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;: gen-logfile ( nnn -- caddr u) 0 &amp;lt;# # # # #&amp;gt; logfile + 3 - swap drop 3 cmove logfile ;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;\ Does this log file exist or is it available (free)?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;\&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;: logfile-free? ( caddr u -- f) r/o open-file ?dup if drop 1 exit then close-file drop 0 &amp;nbsp;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;\ Iterate through to a free logfile.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;\ We support up to 1000 log files before we fail.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;\ (Need a failure handler!)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;\&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;: next-logfile ( -- ) &amp;nbsp;999 0 do i gen-logfile logfile-free? if unloop exit then loop ;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;: wiki-logger ( -- )&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;0 lbcnt !&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;lcd-cls&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;next-logfile&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;logfile w/o create-file ?dup if&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cr lcd-." Can't create log: " lcd-. &amp;nbsp;drop exit&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;then&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;fd !&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;lcd-cr&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;logfile lcd-type lcd-cr&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;lcd-." Ready. Press any button to exit." lcd-cr lcd-cr&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;begin&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;\ sleep only between lines&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;key? 0= lbcnt @ 0= and if wait-for-event then&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;key? if&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;key dup line-buf lbcnt @ + c! &amp;nbsp;1 lbcnt +! ( -- c)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;10 = if&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;line-buf lbcnt @ &amp;nbsp;2dup fd @ &amp;nbsp;write-line drop&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;lcd-type lcd-cr&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 lbcnt !&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;then&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;then&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;button? if&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;\ A button was pressed so clean up&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;\ and exit.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;\&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;button-flush&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;fd @ close-file&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;exit&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;then&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ctp-flush &amp;nbsp; \ not interested&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;again ;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;wiki-logger&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-7416299008125338181?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/7416299008125338181/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=7416299008125338181' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/7416299008125338181'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/7416299008125338181'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/06/wikireader-data-logger.html' title='WikiReader Data Logger'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-4165580841980350970</id><published>2010-05-27T20:15:00.010-04:00</published><updated>2010-05-27T20:32:37.124-04:00</updated><title type='text'>WikiReader Serial Port Hack Pictures</title><content type='html'>Per a recent request...&lt;div&gt;&lt;br /&gt;Here are some pictures of my small hardware hack.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;First, I just added 3 header pin sockets to the already exposed debug port:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_b0Vq0XuF5vM/S_8Lx45EwTI/AAAAAAAAACY/bsIHzGJjoUE/s1600/PICT0132.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 300px;" src="http://1.bp.blogspot.com/_b0Vq0XuF5vM/S_8Lx45EwTI/AAAAAAAAACY/bsIHzGJjoUE/s400/PICT0132.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5476108623619080498" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;But that proved too cumbersome to maintain a good tethered connection to my laptop (plus the batteries would have to be exposed).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So, with the aid of a master machinist (Sandor -- a co-worker), I put a stereo "micro" jack on the top side of the device:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_b0Vq0XuF5vM/S_8Mz5mR_aI/AAAAAAAAACg/2lI-1v3_6vg/s1600/PICT0136.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 300px;" src="http://2.bp.blogspot.com/_b0Vq0XuF5vM/S_8Mz5mR_aI/AAAAAAAAACg/2lI-1v3_6vg/s400/PICT0136.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5476109757680057762" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is the finished result:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_b0Vq0XuF5vM/S_8NPYTfZzI/AAAAAAAAACo/9XwxiJ-8VZo/s1600/PICT0133.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 300px;" src="http://2.bp.blogspot.com/_b0Vq0XuF5vM/S_8NPYTfZzI/AAAAAAAAACo/9XwxiJ-8VZo/s400/PICT0133.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5476110229779212082" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You can see where I (badly) pried open the case ;-)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;And here is where I am today:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_b0Vq0XuF5vM/S_8OfOLizVI/AAAAAAAAACw/jZVIrWtpqrI/s1600/PICT0138.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 300px;" src="http://4.bp.blogspot.com/_b0Vq0XuF5vM/S_8OfOLizVI/AAAAAAAAACw/jZVIrWtpqrI/s400/PICT0138.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5476111601451060562" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now, onto software...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-4165580841980350970?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/4165580841980350970/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=4165580841980350970' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4165580841980350970'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4165580841980350970'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/05/wikireader-serial-port-hack-pictures.html' title='WikiReader Serial Port Hack Pictures'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_b0Vq0XuF5vM/S_8Lx45EwTI/AAAAAAAAACY/bsIHzGJjoUE/s72-c/PICT0132.JPG' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-5859453378195222771</id><published>2010-05-19T22:16:00.002-04:00</published><updated>2010-05-19T22:22:58.514-04:00</updated><title type='text'>So many CFT projects...</title><content type='html'>&lt;div&gt;&lt;ol&gt;&lt;li&gt;&lt;b&gt;Hands-off!&lt;/b&gt; - Small, mountable, personal alarm system. Attach to a bike, briefcase, computer bag, etc.  Arm/Disarm with a key fob. Piercing alarm when someone "moves" your possession. Key fob also has a smaller alarm/buzzer to notify you (up to 10 meters away).&lt;/li&gt;&lt;li&gt;&lt;b&gt;mooTracker&lt;/b&gt;  - Ultra low power GPS tracker for livestock, pets, etc.   Can be used with GSM/SMS module, Iridium modem, etc.  Uses an accelerometer to detect motion before engaging GPS trackers.  Standby current should be &lt;&gt;&lt;li&gt;&lt;b&gt;UV Index Clip&lt;/b&gt; - Small (discrete) UV Index sensor (1" square max). Uses a button cell battery, SiLabs C8051F930, and ANT for communication to iPod/iPhone/Pocket-device to alert you when you've had enough rays.  Can be clipped to clothing or hat.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Crop/Garden moisture monitor&lt;/b&gt;.  Seed your garden (co-op, winery, etc) with low cost, very low power wireless sensors. They contact a hub (with  GSM/SMS capability) to send you status/alerts as text messages. The hub should also support data logging/consolidation for summation or later retrieval.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Portable Power Consumption Data Logger&lt;/b&gt;. The key word is "portable" here.  This data logger/monitor is designed to be used "in the field" with portable devices (sensors, auto accessories, robots, etc).  Mainly for battery powered devices. Should be able to measure power consumption between 0-12volt and between 1uA and 3A.&lt;/li&gt;&lt;li&gt;&lt;b&gt;WikiReader Portable Terminal&lt;/b&gt; - Use the WikiReader as a local/personal display and a controller of UART enabled devices.  Maybe use Bluetooth to use it to query/control sensors.&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So many CFT projects, so little time.  Is there a way to tie them together?&lt;/div&gt;&lt;div&gt;Is there a common theme?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If I only built the things that "I" find useful, which would they be?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I could use #4 in my yard and I have friends that would find it useful.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;My wife could use #3....&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I could see where #1 would be useful, but it generally sounds pretty boring&lt;/div&gt;&lt;div&gt;(from an implementation point of view).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;None of these projects are terribly unique. Maybe my approach is &lt;/div&gt;&lt;div&gt;"low cost / low power". I find it challenging to do a lot with a little.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-5859453378195222771?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/5859453378195222771/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=5859453378195222771' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/5859453378195222771'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/5859453378195222771'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/05/so-many-cft-projects.html' title='So many CFT projects...'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-4971105635415391010</id><published>2010-05-18T19:42:00.002-04:00</published><updated>2010-05-18T19:57:36.759-04:00</updated><title type='text'>Gonzo Engineering</title><content type='html'>This &lt;a href="http://microship.com/resources/gonzo-engineering.html"&gt;manifesto &lt;/a&gt;strikes a chord.  I am not as brave (or insane?) as Steven Roberts, but I do find resonance with his writings.  I remember briefly encountering Roberts at InterOp Spring 1992 where he had a booth showing off his BEHEMOTH bike.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I just finished his &lt;a href="http://www.amazon.com/exec/obidos/ASIN/1929470053/nomadicrese0c-20"&gt;book&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I need to do more about my &lt;i&gt;crazy dreams&lt;/i&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-4971105635415391010?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/4971105635415391010/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=4971105635415391010' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4971105635415391010'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4971105635415391010'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/05/gonzo-engineering.html' title='Gonzo Engineering'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-8773372910849043229</id><published>2010-05-16T16:29:00.002-04:00</published><updated>2010-05-16T16:38:55.378-04:00</updated><title type='text'>WikiReader, Forth and Hacking</title><content type='html'>It's old news, but I find the &lt;a href="http://thewikireader.com/"&gt;WikiReader&lt;/a&gt; very cool. It is an "offline" pocket size wikipedia reader (searches a mini-SD card of a wikipedia dump). It came out last fall (2009) and it has already been subject to a teardown and random hacks.  What finally got me interested is knowing that it runs a cross compiled (almost ANSI) Forth.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I've been doing a lot of low level and high level Forth recently and wanted a "lighweight" hackable device for some mall programming (my 11 yr old son plays Warhammer 4K at a local mall and can be engaged for up to 3 hrs -- ugh, 3 hrs of waiting in a mall).  The problem with most of my devices is that they have lots of wires, bare boards and LEDs. I don't need the attention (blinking LED.. somebody call the police!).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So, I got me a WikiReader and I've already opened it up to hack in a connector for a serial port (pictures later).  &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The toolchain and &lt;a href="http://github.com/wikireader/wikireader"&gt;source code&lt;/a&gt; is free (developed under Linux w/ open source tools), so I installed ubuntu (once again: goodbye windows) and was quickly cross compiling new Forth engines!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;More later, but some quick mini-stats:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The device works off of 3 AAA batteries and draws 11-13mA (avg) while "idle" (waiting for a touch screen or serial event) and 80-90mA (avg) while searching, handling I/O and doing wikipedia stuff.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Not bad.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;/todd&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-8773372910849043229?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/8773372910849043229/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=8773372910849043229' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/8773372910849043229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/8773372910849043229'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/05/wikireader-forth-and-hacking.html' title='WikiReader, Forth and Hacking'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-9105152337536720292</id><published>2010-04-28T09:42:00.004-04:00</published><updated>2010-04-28T10:25:52.992-04:00</updated><title type='text'>myforth, 8051 and iRobot Create</title><content type='html'>At the end of my previous post I entertained the idea of using a SiLabs C8051 for controlling the Create.  Of course, I can't run Lua on that MCU, so the obvious alternative is Forth.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;But which Forth?  I have a copy of SwiftX for the 8051, but I decided to look at an interesting environment called &lt;a href="http://www.forth.org/svfig/kk/11-2009-Nash-11pages.pdf"&gt;MyForth &lt;/a&gt;that i found &lt;a href="http://www.kiblerelectronics.com/kibler/forth.shtml"&gt;here&lt;/a&gt;.  This is the, quite detailed, &lt;a href="http://www.kiblerelectronics.com/kibler/MyForth_Reference_Manual.doc"&gt;manual&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;Its non-standard (I don't really care), influenced by colorforth (yeah!) and completely tied to the 8051.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In this day and age, who would use a language completely tied to a platform?  Well, apparently, the point of MyForth was to produce a true 8-bit Forth that would match the 8-bit nature of the 8051. (Most 8051 Forths are 16-bit, while the registers and most efficient instructions on the 8051 are 8-bit based.)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;After a while, I started to think: so what?  As modern programmers we've embraced portability over efficiency.  No, its more that that: We strive to avoid software that locks us to a particular piece of hardware.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Is this a real problem (all of the time)?  If I want to augment Create (or other consumer robots) with an MCU and some code, should I strive to make it portable? Or do I just concern myself with the problem at hand: Making the robot do interesting things.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Another plus for MyForth is its development environment: It uses gforth as a cross-compiler.  I have full access to the cross (meta) compilation. I can craft MyForth to become "my forth".  So, who says I can't re-target it for another MCU?  Or, at the very minimum, use it as a model for cross-compilation.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Interesting reading and hacking for the weekend.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-9105152337536720292?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/9105152337536720292/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=9105152337536720292' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/9105152337536720292'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/9105152337536720292'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/04/myforth-8051-and-irobot-create.html' title='myforth, 8051 and iRobot Create'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-4261236458156978558</id><published>2010-04-24T15:34:00.003-04:00</published><updated>2010-04-24T15:53:48.912-04:00</updated><title type='text'>eLua and mbed and iRobot Create</title><content type='html'>Mbed is 5V tolerant.  This means I should be able to connect a board directly to the &lt;a href="http://store.irobot.com/shop/index.jsp?categoryId=3311368"&gt;iRobot Create&lt;/a&gt; that has been sitting gathering dust for a couple of years.  I couldn't get motivated to write in C for it; I didn't have a viable Forth option at the time (although now I do).&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Since the Create sucks big power as it is, the addition of an mbed shouldn't be a problem.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;While I am quite deep into Forth these days, development may be better suited for eLua (since it is free).   Maybe?  Something to think about.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Of course, the SiLabs C8051F340x is also fully 5V tolerant (including power supply) with fewer external circuit requirements and much lower power consumption.  I can't run eLua on it, but I've got my trusty SwiftX 8051 Forth....&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So many options, so little time.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-4261236458156978558?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/4261236458156978558/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=4261236458156978558' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4261236458156978558'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4261236458156978558'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/04/elua-and-mbed-and-irobot-create.html' title='eLua and mbed and iRobot Create'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-1200768286674418536</id><published>2010-04-24T14:26:00.003-04:00</published><updated>2010-04-24T15:32:51.845-04:00</updated><title type='text'>eLua and mbed</title><content type='html'>Sometimes I get lost in the whole "low power" thing.  I've been focused so much on power saving processors that I forget what fun it is to just &lt;i&gt;program&lt;/i&gt;.  Forth is great for getting the job done, but sometimes I just want to play around with algorithms and want something a little more... infix.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So, &lt;a href="http://www.eluaproject.net/"&gt;eLua &lt;/a&gt;fits the bill, especially on &lt;a href="http://mbed.org/"&gt;mbed&lt;/a&gt;. (Lua on Cortex-M3!  Yay!)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-1200768286674418536?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/1200768286674418536/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=1200768286674418536' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/1200768286674418536'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/1200768286674418536'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/04/elua-and-mbed.html' title='eLua and mbed'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-6564143332182684416</id><published>2010-04-12T22:46:00.003-04:00</published><updated>2010-04-12T22:54:57.836-04:00</updated><title type='text'>mbed (Cortex-M3) and MPE Forth</title><content type='html'>&lt;a href="http://mbed.org/"&gt;Mbed &lt;/a&gt;is a neat little NXP LPC1768 based Cortex M3 development environment. It has a web based IDE, but I'm not interested in that. You can flash it by dragging a *.bin file to its embedded flash drive. Once you drag, you reset (via pushbutton) and a second or two later the device is reprogrammed.&lt;br /&gt;&lt;br /&gt;This made a nice target for MPE's &lt;a href="http://www.mpeforth.com/xc7.htm#cortex"&gt;Forth 7 Cortex-M3&lt;/a&gt; cross compiler.  (I purchased the inexpensive "Stamp" version for ~ $115).&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There was no included Mbed support, so I attempted a port.  The port was easy -- I got the LEDs to blink. Now to figure out what to do with the thing...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;While the LPC1768 has some interesting low power modes, the extra programming/flash-drive circuitry of the mbed doesn't allow full exploitation.  However, until the &lt;a href="http://www.energymicro.com/products/efm32-gecko-starter-kit"&gt;Gecko Starter Kit&lt;/a&gt; becomes available, the mbed will do (for development purposes).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-6564143332182684416?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/6564143332182684416/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=6564143332182684416' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/6564143332182684416'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/6564143332182684416'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/04/mbed-cortex-m3-and-mpe-forth.html' title='mbed (Cortex-M3) and MPE Forth'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-4687300324405122226</id><published>2010-03-13T13:59:00.002-05:00</published><updated>2010-03-13T14:09:00.952-05:00</updated><title type='text'>SiLabs C8051 and SwiftX Forth</title><content type='html'>It's been a while since I've posted... I am very busy these days. :-(&lt;br /&gt;&lt;br /&gt;I am currently playing with SiLabs C8051F344 with a purchased copy of Forth Inc's SwiftX (under Windows -- my Linux development effort never fully cooked).&lt;br /&gt;&lt;br /&gt;I am impressed with the speed of this "lowly" 8051 derived 8-bitter. It isn't meant to do big things, but for small things it fairly rocks.&lt;br /&gt;&lt;br /&gt;I've previously played with the C8051F93x very lower power MCU, but given my current interests (GPS tracking), the difference in power consumption between that very low power part and the more power hungry F344 is minimal.  The GPS consumes so much current when running that the MCU is just "noise" in any power chart plots.&lt;br /&gt;&lt;br /&gt;When asleep, the difference between consuming 1uA (sleep mode) on the F93xx vs 25-50uA on the F344 (clocking way down to around 40Khz) is not worth considering (we are talking years of battery life for either).&lt;br /&gt;&lt;br /&gt;More on my current project later... but for now I am just enjoying crafting Forth on a 8-bit MCU :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-4687300324405122226?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/4687300324405122226/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=4687300324405122226' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4687300324405122226'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4687300324405122226'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/03/silabs-c8051-and-swiftx-forth.html' title='SiLabs C8051 and SwiftX Forth'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-6168790716107784114</id><published>2010-01-05T21:01:00.002-05:00</published><updated>2010-01-05T21:14:15.257-05:00</updated><title type='text'>SwiftX Forth and 8051 and Linux</title><content type='html'>Maybe 3 other people in the world would probably be interested in hearing that I have gotten the evaluation copy of SwiftX Forth running under Linux (Wine) talking to Silab's USB &lt;a href="http://www.silabs.com/PRODUCTS/MCU/Pages/ToolStick.aspx"&gt;Toolstick's &lt;/a&gt; C8015F931 &lt;a href="http://www.silabs.com/Support%20Documents/TechnicalDocs/ToolStick_F931_DC_UG.pdf"&gt;daughter card.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I had to steal the daughter card UART and re-route it to a separate USB-&gt;UART bridge for SwitfX's XTL (programming still works through the Toolstick), but it all works (so far) under both Windows and Linux (Ubuntu!).&lt;br /&gt;&lt;br /&gt;I am playing around with 8051s because I am feeling retro and a bit weary of the TI MSP430 family.  The C8015F931 has some impressive low power numbers and some neat features to make even a lowly 8051 appealing.&lt;br /&gt;&lt;br /&gt;I have to remember to do a post on my newest interest: Augmenting sensors with tiny low power MCUs to make them smarter.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-6168790716107784114?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/6168790716107784114/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=6168790716107784114' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/6168790716107784114'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/6168790716107784114'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2010/01/swiftx-forth-and-8051-and-linux.html' title='SwiftX Forth and 8051 and Linux'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-4474385308207026347</id><published>2009-12-04T23:06:00.001-05:00</published><updated>2009-12-04T23:07:18.699-05:00</updated><title type='text'>uForth 0.99 -- almost there....</title><content type='html'>A bit fatter, but more capable... Plus there is some initial refactoring of the code. Download the latest &lt;a href="http://maplefish.com/todd/uforth.html"&gt;here &lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-4474385308207026347?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/4474385308207026347/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=4474385308207026347' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4474385308207026347'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4474385308207026347'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/12/uforth-099-almost-there.html' title='uForth 0.99 -- almost there....'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-2539659898057826759</id><published>2009-11-02T21:10:00.003-05:00</published><updated>2009-11-02T21:21:42.430-05:00</updated><title type='text'>case statements in uForth</title><content type='html'>case .. of .. endof .. endcase  was surprisingly easy to implement:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;\ Variable used to keep track of how many 'of' clauses we have.&lt;br /&gt;\&lt;br /&gt;variable _endof&lt;br /&gt;&lt;br /&gt;: case ( n -- )&lt;br /&gt;   0 _endof !&lt;br /&gt;   [compile] &gt;r&lt;br /&gt;; immediate&lt;br /&gt;&lt;br /&gt;: of ( n -- )&lt;br /&gt;   [compile] r@&lt;br /&gt;   [compile] =&lt;br /&gt;   postpone if&lt;br /&gt;; immediate&lt;br /&gt;&lt;br /&gt;: endof ( -- )&lt;br /&gt;   _endof incr&lt;br /&gt;   postpone else&lt;br /&gt;; immediate&lt;br /&gt;&lt;br /&gt;: endcase ( -- )&lt;br /&gt;   _endof @ 0 do postpone then loop&lt;br /&gt;   [compile] r&gt;&lt;br /&gt;   [compile] drop&lt;br /&gt;; immediate&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And, an example:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;: test  ( number -- )&lt;br /&gt;    case&lt;br /&gt;       1 of ." one" endof&lt;br /&gt;       2 of ." two" endof&lt;br /&gt;       3 of ." three" endof&lt;br /&gt;       ." none"&lt;br /&gt;    endcase&lt;br /&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-2539659898057826759?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/2539659898057826759/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=2539659898057826759' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2539659898057826759'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2539659898057826759'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/11/case-statements-in-uforth.html' title='case statements in uForth'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-3849651325986977682</id><published>2009-10-30T20:46:00.004-04:00</published><updated>2009-10-30T21:10:08.502-04:00</updated><title type='text'>Hexbug + MSP430 = Robotrophic Parasitism</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_b0Vq0XuF5vM/SuuNHvCCPRI/AAAAAAAAACQ/xStq363B0ks/s1600-h/PICT0087.JPG"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://2.bp.blogspot.com/_b0Vq0XuF5vM/SuuNHvCCPRI/AAAAAAAAACQ/xStq363B0ks/s320/PICT0087.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5398563742357273874" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;It's been almost 2 years since I wrote about my interest in &lt;a href="http://toddbot.blogspot.com/2007/11/biotrophic-parasitism-as-computing.html"&gt;Biotrophic Parasitism&lt;/a&gt; in robotics...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;In Biotrophic Parasitism, the parasite and host co-exist with (potentially) mutual benefits.&lt;div&gt;In what I am calling &lt;i&gt;Robotrophic Parasitism&lt;/i&gt;, the parasite (in this case a MSP430 based $3 &lt;a href="http://focus.ti.com/docs/toolsw/folders/print/ez430-t2012.html"&gt;EZ430-T2102&lt;/a&gt;),  and the host (an original $10 &lt;a href="http://www.hexbug.com/"&gt;Hexbug&lt;/a&gt;) live happily together.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In this case, the parasite was minimally invasive: the EZ430 lives between the battery switch and the Hexbug circuit, controlling the power. It also has a bi-directional line tapped to the antenna sensors so it can detect a "bump" or steer (the original hexbug only turns clockwise).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The parasite seeks light and steers the bug in that direction. When you first apply power, the parasite turns the hexbug clockwise (up to 6 times)  looking for any light bearing direction. It then drives the hexbug in that direction. If the light wanes, it will then do another set of clockwise searches looking for a stronger light source.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I've got some fine tuning to do...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The parts list:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;1 EZ430-T2102 board.&lt;/li&gt;&lt;li&gt;1 Hexbug.&lt;/li&gt;&lt;li&gt;1 photoresistor and 1 voltage dividing 1/8 watt resistor (from my parts bin).&lt;/li&gt;&lt;li&gt;1 TS5A3127DBVRG4 analog switch (free sample from TI).&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;Total Cost: ~ $15&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This is the first of (hopefully) many Hexbug Robotrophic Parasites!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-3849651325986977682?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/3849651325986977682/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=3849651325986977682' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/3849651325986977682'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/3849651325986977682'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/10/hexbug-msp430-robotrophic-parasitism.html' title='Hexbug + MSP430 = Robotrophic Parasitism'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_b0Vq0XuF5vM/SuuNHvCCPRI/AAAAAAAAACQ/xStq363B0ks/s72-c/PICT0087.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-3406860815213244323</id><published>2009-10-28T16:04:00.006-04:00</published><updated>2009-10-28T16:16:58.889-04:00</updated><title type='text'>Unschooling days...</title><content type='html'>&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_b0Vq0XuF5vM/SuilWJ3MPcI/AAAAAAAAACI/Y1NvAD231vo/s1600-h/P1040224.JPG"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_b0Vq0XuF5vM/SuilWJ3MPcI/AAAAAAAAACI/Y1NvAD231vo/s320/P1040224.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5397745953426652610" /&gt;&lt;/a&gt;Wednesday early afternoon...&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_b0Vq0XuF5vM/Suik-E8KD1I/AAAAAAAAACA/WathiIbMlOQ/s1600-h/Claire.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 240px; height: 320px;" src="http://1.bp.blogspot.com/_b0Vq0XuF5vM/Suik-E8KD1I/AAAAAAAAACA/WathiIbMlOQ/s320/Claire.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5397745539788443474" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: right;"&gt;&lt;span class="Apple-style-span"  style="color:#0000EE;"&gt;&lt;span class="Apple-style-span" style="text-decoration: underline;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Claire in &lt;i&gt;&lt;b&gt;her&lt;/b&gt;&lt;/i&gt;&lt;b&gt; &lt;/b&gt;tree.&lt;div&gt;&lt;div style="text-align: right; "&gt;Annie drawing worms (science). &lt;/div&gt;&lt;div style="text-align: right; "&gt;Nate hacking Python.&lt;/div&gt;&lt;div style="text-align: right;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: right;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-3406860815213244323?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/3406860815213244323/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=3406860815213244323' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/3406860815213244323'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/3406860815213244323'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/10/unschooling-days.html' title='Unschooling days...'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_b0Vq0XuF5vM/SuilWJ3MPcI/AAAAAAAAACI/Y1NvAD231vo/s72-c/P1040224.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-5372553877369613346</id><published>2009-10-27T22:56:00.002-04:00</published><updated>2009-10-27T23:00:11.174-04:00</updated><title type='text'>uForth 0.96 -- getting closer...</title><content type='html'>I've simplified uforth.c in this release.  Some words coded in C were moved to core.f and init.f.&lt;div&gt;This made the C code smaller, so you can now compile uForth with the free IAR MSP430 Kickstart Edition!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Still no DOES&gt; (not sure how to do this without dictionary rewriting which is a no-no in my MSP430 flash approach).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It is nicely shaping up though. I am really enjoying rewriting parts of uforth.c in uForth itself (see core.f and init.f in the distribution).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Downloads are &lt;a href="http://maplefish.com/todd/uforth.html"&gt;here&lt;/a&gt;.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-5372553877369613346?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/5372553877369613346/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=5372553877369613346' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/5372553877369613346'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/5372553877369613346'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/10/uforth-096-getting-closer.html' title='uForth 0.96 -- getting closer...'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-1544217976708902693</id><published>2009-10-16T16:20:00.003-04:00</published><updated>2009-10-16T16:25:46.583-04:00</updated><title type='text'>uforth 0.921 -- more pre-release goodness</title><content type='html'>Visit &lt;a href="http://maplefish.com/todd/uforth.html"&gt;uforth  &lt;/a&gt;for the latest "on your own for now" pre-release.  I've included a link to a prebuilt binary for the MSP430 ez430-rf2500 board.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It's more robust and comprehensive. Plus it supports direct word compiles to the MSP430 flash.&lt;/div&gt;&lt;div&gt;It weighs just over 8KB flash + 900 bytes RAM.  It support an 8KB (4096 cell) dictionary, so there is plenty of room to play.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The PC/Unix version still works well too. I use it for new dictionary development and create a TI file of the compiled dictionary for the MSP430. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Nothing automated yet and very little documentation. But, hey you can define words, loop and do some "meta" stuff.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-1544217976708902693?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/1544217976708902693/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=1544217976708902693' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/1544217976708902693'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/1544217976708902693'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/10/uforth-0921-more-pre-release-goodness.html' title='uforth 0.921 -- more pre-release goodness'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-5707605765829242899</id><published>2009-10-07T08:37:00.003-04:00</published><updated>2009-10-07T08:47:24.093-04:00</updated><title type='text'>uForth 0.7  pre-release</title><content type='html'>Last night I finally made some progress with compiling to the MSP430 flash dictionary: I can now compile words on the MSP430!&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I also moved the MSP430 development to the more widely available (and cheaper!)  ez430RF module (MSP430F2274 based).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Unoptimized, the VM/interpreter is 6.6KB and the RAM footprint is 844 bytes (essentially leaving room for 90 one cell variables on the MSP430F2274).  I made the dictionary 4092 words (~8KB) to leave room for C app code.  The uForth dictionary is (by architecture)  limited to 32KB.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The brave can grab at snapshot (or look at documentation)  &lt;a href="http://maplefish.com/todd/uforth.html"&gt;here&lt;/a&gt;.  If you have an ez430RF and you want to poke about (you're on your own for now), you can grab this big TI format flash file &lt;a href="http://maplefish.com/todd/uforth-msp430f2274.txt"&gt;here&lt;/a&gt;. This file contains both the VM/interpreter and a dictionary.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-5707605765829242899?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/5707605765829242899/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=5707605765829242899' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/5707605765829242899'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/5707605765829242899'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/10/uforth-07-pre-release.html' title='uForth 0.7  pre-release'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-4464788833469326115</id><published>2009-10-04T20:52:00.008-04:00</published><updated>2009-10-04T23:08:01.227-04:00</updated><title type='text'>Development Support words for uForth</title><content type='html'>&lt;blockquote&gt;&lt;/blockquote&gt;Support words shouldn't be in the core. As smaller as it could be to write in C, I am resisting the urge of making the core larger.  Take for instance "words". It is very, very useful for debugging but not so useful in a "finished" system.  Why should it eat precious RAM or Flash if you don't need it?&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is a quick definition of words in uForth. You can place it in init.f (for BOOTSTRAP versions) or pass it to "uforth_interpret()". It depends on a few words I've already shipped in init.f:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;( Implementation of words in pure uForth! )&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;create _  ( dummy "known length" entry )&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;variable last_word &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;variable ccnt  ( keep track of # of characters on a line)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;: words ( -- )&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;_ 6 - @ last_word ! ( We know where the prev word link is inside of _ )&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;0 ccnt !&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;    last_word @                          ( pointer to last word )&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;    begin&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;dup                              ( keep it on the stack )&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;1+ count 63 and dup ccnt +!      ( get length of word's name )&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;ccnt @ 70 &gt; if cr 0 ccnt ! then  ( 70 characters per line )&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;type     32 emit 32 emit         ( print word's name )&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;2 ccnt +!                        ( add in spaces )&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;@                                ( get prev link from last word )&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;dup -1 =                         ( -1 link means no more words! )&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;    until&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;    drop ;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-4464788833469326115?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/4464788833469326115/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=4464788833469326115' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4464788833469326115'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4464788833469326115'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/10/development-support-words-for-uforth.html' title='Development Support words for uForth'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-5607127944666747558</id><published>2009-10-02T07:13:00.002-04:00</published><updated>2009-10-02T07:23:28.275-04:00</updated><title type='text'>Simulating MSP430 I/O on PC uForth (Solution?)</title><content type='html'>One horrible solution (but may work for me) is to simulate the MSP430 I/O under PC uForth.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Keep in mind: uForth is about &lt;i&gt;scripting, &lt;/i&gt;not about writing system level Forth stuff on an MCU. It is meant for slinging around C functions and libraries.  I don't intend on doing much bit banging in uForth. There will be no UART driver, no interrupt handler, no deep notion of MSP430 power modes.  SwiftX Forth (and others?) is the best fit for that.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I want to take existing C app (maybe already running on an MSP430) and manipulate it.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;However, some times I may want to toggle some ports.  I can do this with a minimal RAM_DICT uForth on the MCU. That may be adequate. This would allow me to hack the MSP430.  Maybe I should create a special "hackers" dictionary for the MCU that allows me to bit bang ports and interact with peripherals. (This *should* be a writable dictionary.. try blinking an LED without some sort of DO .. LOOP construct -- this requires compilation!)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If I really do need the ability to do bit banging in the full "scripted application", I should be able to simulate it on the PC uForth.  This wouldn't be a full MSP430 simulation, but maybe just enough so that I can compile the word, test it (maybe textual output: "LED bit0/port1 is ON!") and then dump/flash the dictionary.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Just a thought...  but, uh it sounds oh so "batchy".&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-5607127944666747558?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/5607127944666747558/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=5607127944666747558' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/5607127944666747558'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/5607127944666747558'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/10/simulating-msp430-io-on-pc-uforth.html' title='Simulating MSP430 I/O on PC uForth (Solution?)'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-775937096887274589</id><published>2009-10-02T06:54:00.002-04:00</published><updated>2009-10-02T07:11:30.652-04:00</updated><title type='text'>uForth MSP430isms</title><content type='html'>I'm trying to figure out how to best do uForth word compilation on the MSP430.  Right now, if you want to do that you must use the RAM_DICT option (RAM based dictionary). This is inconvenient at best. A typical MSP430 part will have between 1KB to 8KB of RAM.  Your initial dictionary may be larger than that!&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Then there is the problem that compilation often involves rewriting memory (resolving BEGIN, DO .. LOOP references, etc).  The MSP430 main memory is divided into 512 byte segments. And, each segment must be erased before writing (technically, you can write twice safely without an erase).  What if the word definition spans two segments?  I would need at least 512 bytes of RAM for buffering. Will I need more?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Another approach is to use a "tethered" development environment.  With this, I would attach the PC uForth to the MSP430 uForth, compile the word locally and send the byte codes to the MSP430 to be flashed.  This simplifies Flashing since there doesn't need to be a concern for rewriting bytes.  However, this means that the PC and MSP430 uForths must be tightly bound.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;SwiftX Forth takes a more formal tethered approach, but I like the more standalone nature of uForth right now.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The batch approach I take right now is to develop and test the word on the PC uForth, dump the dictionary and recompile the MSP430 Forth with this dictionary (flash based).  The big problem with that can be summarized by the following example --&gt; &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;: led-on  bit0 port1 mem! ;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Ugh.  There is no analogue for this on the PC uForth.   My only recourse is to use a RAM based MSP430. But, after defining "port1", "mem!", etc.  a 1KB RAM MSP430 part won't be big enough to support the dictionary. (And, obviously, using a Flash based MSP430 uForth, I won't be able to define led-on !)&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Solution to follow... hopefully...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-775937096887274589?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/775937096887274589/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=775937096887274589' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/775937096887274589'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/775937096887274589'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/10/uforth-msp430isms.html' title='uForth MSP430isms'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-6315265502756401372</id><published>2009-10-01T21:58:00.003-04:00</published><updated>2009-10-01T22:02:26.252-04:00</updated><title type='text'>uForth 0.4 ... more preliminary madness</title><content type='html'>Still very, very alpha. But here is another tarball: &lt;a href="http://maplefish.com/todd/uforth.04.tar.gz"&gt;version 0.4&lt;/a&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I got FLASH based MSP430 support working. No interactive compiling into Flash, but you can build a dictionary on the PC and then rebuild the MSP430 version with a Flash based dictionary.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Default still uses RAM_DICT under MSP430.  The &lt;a href="http://maplefish.com/todd/uforth.html"&gt;quick reference&lt;/a&gt; is still the best way to make sense of what you've downloaded.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-6315265502756401372?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/6315265502756401372/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=6315265502756401372' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/6315265502756401372'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/6315265502756401372'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/10/uforth-04-more-preliminary-madness.html' title='uForth 0.4 ... more preliminary madness'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-2387739291072502142</id><published>2009-09-30T20:47:00.002-04:00</published><updated>2009-09-30T20:58:04.650-04:00</updated><title type='text'>uForth preliminary release... very, very alpha</title><content type='html'>This probably won't be usable for anyone and it isn't organized well at all. In fact, you could view it as a drunken pseudo-intellectual ramble captured as source code.  It may mean something, or it just could be plain useless. For me, personally, it is an achievement.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I am sitting here right now, enjoying a Taylor Fladgate 10 year old Tawny Port, listening to a heady mix of Abdullah Ibrahim, Michael Franti, Dinosaur Jr. and Arcade Fire, considering if I should release &lt;a href="http://maplefish.com/todd/uforth.html"&gt;this&lt;/a&gt;. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Aw, hell. If you want to muck with it, go ahead. Here is the (probably uncompilable) tarball of &lt;a href="http://maplefish.com/todd/uforth.tar.gz"&gt;uForth&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;P.S.  I actually got it to run on an MSP430 today (via Rowley Crossworks).  I can't promise support, nor can I promise a steady stream of releases, although it is geared to become the basis of some stuff at my day job.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-2387739291072502142?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/2387739291072502142/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=2387739291072502142' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2387739291072502142'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2387739291072502142'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/09/uforth-preliminary-release-very-very.html' title='uForth preliminary release... very, very alpha'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-5225137428545032193</id><published>2009-09-27T13:31:00.004-04:00</published><updated>2009-09-27T14:23:15.667-04:00</updated><title type='text'>u4th - Forth for microcontrollers</title><content type='html'>Okay, I got tired of searching and waiting.  I decided to roll my own "portable" Forth targeted for microcontrollers with limited resources.  I want to do a Forth that would work on MSP430s, ARM Cortex and desktop PCs. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This would be more of a "scripting" Forth vs a full bottom up programming language. It would expect to be embedded in C and able to call C functions (like a scripting language!). &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Right now I have something working on both a PC and MSP430 (simulator).  u4th is written in C and makes no presumption about I/O (you can extend and add UART support, but it is happy to just work with a dictionary and an init()  function).  It supports a RAM or ROM/Flash resident dictionary (but no Flash writing support built in).  It compiles a position independent dictionary that can be transfered to/from a PC and MCU without modification.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It does not implement ANSI Forth.. it is it's own beast geared for scripting, not system building.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I have a few more things to add (no DO .. LOOP yet) , but right now it runs (interpreter + VM) just under 4KB RAM (with a 2KB RAM resident dictionary -- so if the dictionary is Flash based, we are talking well under 2KB RAM!) and around 7KB of program (flash resident code).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;More to follow!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;/todd&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-5225137428545032193?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/5225137428545032193/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=5225137428545032193' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/5225137428545032193'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/5225137428545032193'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/09/u4th-forth-for-microcontrollers.html' title='u4th - Forth for microcontrollers'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-6138661199508405166</id><published>2009-08-26T08:35:00.004-04:00</published><updated>2009-08-26T08:51:20.621-04:00</updated><title type='text'>compose-tex vs AFT</title><content type='html'>I've been doing some &lt;a href="http://maplefish.com/todd/aft.html"&gt;AFT &lt;/a&gt;hacking for a person who needed some text support. There are many AFT alternatives out there these days but he says that AFT hits the spot because it produces LaTeX as well as HTML.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There are some decent LaTeX to HTML converters out there too (have been for years). &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I've been thinking about making a simple "free-ish text" converter that produces only LaTeX. It would be a LaTeX helper of sort. It would allow a casual user the ability to produce very high quality print without the learning curve of LaTeX. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The trick is, the "almost free text" format markup would have to be beautiful. The idea is "beautiful plain text in", "beautiful print out".&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;What if everyone could produce beautiful print?  What would you typeset?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-6138661199508405166?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/6138661199508405166/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=6138661199508405166' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/6138661199508405166'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/6138661199508405166'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/08/compose-tex-vs-aft.html' title='compose-tex vs AFT'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-3781556840884755115</id><published>2009-07-03T22:47:00.002-04:00</published><updated>2009-07-03T22:56:10.967-04:00</updated><title type='text'>Living my values...</title><content type='html'>&lt;div&gt;This old blog &lt;a href="http://gevertulley.wordpress.com/2008/12/04/on-leaving-adobe/"&gt;entry&lt;/a&gt; struck a chord. I followed a bunch of links from &lt;a href="http://www.ted.com/speakers/gever_tulley.html"&gt;TED&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-3781556840884755115?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/3781556840884755115/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=3781556840884755115' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/3781556840884755115'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/3781556840884755115'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/07/living-my-values.html' title='Living my values...'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-3923413512387709034</id><published>2009-07-02T21:48:00.003-04:00</published><updated>2009-07-02T22:01:53.040-04:00</updated><title type='text'>Colorforth as inspiration</title><content type='html'>I always keep up the best I can with what Chuck Moore (inventor of Forth) is up to.  I've always found colorforth to be fascinating.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Mr. Moore has started a couple of blogs. Of particular interest is his recent &lt;a href="http://colorforth.com/haypress.htm"&gt;blog &lt;/a&gt;for tracking progress with his latest creation.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This reminds me why playing with hardware is so much fun.  I am a bare-metal guy at heart, although there isn't much opportunity for doing this type of work (for me) these days.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;How do I make a career out of bare metal progamming?  Forth gives me some of this thrill.  I like to poke and peek hardware to see it work.  Something about batch compiling/loading (C and C++) through an IDE loses that feel.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I don't really want to "roll my own" Forth these days.  Language design as a thrill has come and pass. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt; I  got a buzz out of using SwiftX Forth (for the MSP430) at work a while back.  Getting an unsupported MSP430 (the MSP430F5XX) working with SwiftX was a blast.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If I can scrape together $395 for a SwiftX MSP430 license (for non-work use), I'd like to kickstart an idea I had for doing a &lt;a href="http://focus.ti.com/docs/toolsw/folders/print/simpliciti.html"&gt;Simpliciti &lt;/a&gt;clone in Forth.... but my wife's van needs new tires :-(&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-3923413512387709034?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/3923413512387709034/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=3923413512387709034' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/3923413512387709034'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/3923413512387709034'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/07/colorforth-as-inspiration.html' title='Colorforth as inspiration'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-8339315517165353914</id><published>2009-06-15T07:32:00.002-04:00</published><updated>2009-06-15T07:35:57.982-04:00</updated><title type='text'>More on (embedded) C++</title><content type='html'>Interesting &lt;a href="http://www.research.att.com/%7Ebs/abstraction-and-machine.pdf"&gt;paper &lt;/a&gt;regarding using C++ for embedded work by Stroustrup.  I wonder how much of this is taken to heart by embedded developers.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-8339315517165353914?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/8339315517165353914/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=8339315517165353914' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/8339315517165353914'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/8339315517165353914'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/06/more-on-embedded-c.html' title='More on (embedded) C++'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-7366849023696993732</id><published>2009-06-11T16:41:00.003-04:00</published><updated>2009-06-11T16:59:31.817-04:00</updated><title type='text'>Evaluating the Cortex-M3</title><content type='html'>So, I have 2 evaluation kits: the &lt;a href="http://stm32circle.com/"&gt;stm32circle  &lt;/a&gt;and the &lt;a href="http://www.hitex.com/index.php?id=stm32-performancestick"&gt;stm32-performancestick&lt;/a&gt;.  Each under $100 and each with interesting features and annoyances.  I've spent around $130 between the two. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt; I suppose it would have made more sense to just get the Olimex header board (&lt;span class="Apple-style-span" style="color: rgb(119, 119, 110); font-size: 12px; line-height: 21px; "&gt; &lt;a href="http://www.sparkfun.com/commerce/product_info.php?products_id=8559"&gt;STM32-H103&lt;/a&gt;)&lt;/span&gt; for $40, a $70-100 JTAG, and GCC, but the point of the evaluation excercise is NOT to spend hours doing the "let's build everything from scratch".  When the right &lt;i&gt;integrated &lt;/i&gt;environment is chosen it sometimes worth the money. I still (and will continue to) do my source code editing in emacs but I have become pampered by the often richer experience of debugging with a decent IDE.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I would still like to just use emacs + gdb + gcc for development, but while I'm learning the chip I'd rather have an IDE with integrated documentation and GUI hand holding.  My days of grunting manly about how I built all my tools by hand and debug via gdb command line is probably over. I will probably never replace my beloved emacs (used mainly out of habit)  for editing and browsing code, but the point here is to &lt;i&gt;hit the ground running &lt;/i&gt;and focus on the Cortex.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So far... stm32circle and Raisonance is nice, but I have no interest in CircleOS, so I've yet to see what it offers me in turns of raw EABI programming. Raisonance Ride is limiting me to 32KB debugging.  I suppose I won't be using a lot of the advanced features of the stm32circle (color LCD, sound, etc) but it is a very rich platform (for only $40).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The smt32-performance sticks comes through Hitex (which is promising me unlimited debugging after I send them email).  No response yet. The older license key (I am using the most up to date version of the debugger) doesn't work. They said I should email them a request for a new license.  I was able to run their "dashboard" which allows me to do some performance/power tests. This is very informative.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;At some point I will choose one or the other to do some development with.  I guess I am hoping that the stm32circle will "win". Ride7 looks nice (reminds me of Crossworks). I need to see how well it does without forcing me into CircleOS.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I'll post updates in the next couple of days.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-7366849023696993732?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/7366849023696993732/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=7366849023696993732' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/7366849023696993732'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/7366849023696993732'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/06/evaluating-cortex-m3.html' title='Evaluating the Cortex-M3'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-6073500641565015022</id><published>2009-06-08T10:24:00.002-04:00</published><updated>2009-06-08T10:28:11.730-04:00</updated><title type='text'>Forth on the Cortex-M3?</title><content type='html'>I can't seem to find any Forth running on a Cortex-M3 (let alone an ARM Thumb).  This is the reason why I started to look at C++ again.  I'm getting sick of plain old C -- great for little things, but I have bigger fish to fry.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I won't bother to convince myself that I have time to craft/port a Forth to the Cortex.  However, I wonder if porting a Forth written in C is an acceptable compromise?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Hmm...&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-6073500641565015022?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/6073500641565015022/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=6073500641565015022' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/6073500641565015022'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/6073500641565015022'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/06/forth-on-cortex-m3.html' title='Forth on the Cortex-M3?'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-8957739770383230065</id><published>2009-06-07T14:08:00.004-04:00</published><updated>2010-05-02T16:18:25.996-04:00</updated><title type='text'>Stroustrup's new book</title><content type='html'>I swore I would never do C++ programming again (3 yrs ago).  Never say never.  I realize that I miss some of the abstractive capabilities compared to C. I don't miss OO, I miss Generic Programming.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I was browsing &lt;a href="http://reiters.com/"&gt;Reiters &lt;/a&gt; a couple of weeks ago and was shocked to find this &lt;a href="http://www.stroustrup.com/Programming/"&gt;book&lt;/a&gt;. C++ as a first language? I was intrigued.  I think that Stroustrup is a good concise writer and I wondered what an "intro to programming" book would look like (coming from his hands).  &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I purchased the book last week.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The book is interesting.  I don't know how well it would do with a newbie, but I tend to like his no-bullshit approach. It is quite refreshing.  He is very pragmatic and I liked how STL (generic programming) takes a front seat.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I am also a fan of &lt;a href="http://www.stepanovpapers.com/"&gt;Alexander Stepanov&lt;/a&gt;.  He has a &lt;a href="http://www.elementsofprogramming.com/"&gt;book &lt;/a&gt;coming out this month. I've already pre-ordered it.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This nicely meshes wth my current interest in Cortex M3 microcontrollers. I don't want to resort to C programming when I start messing with my &lt;a href="http://stm32circle.com/"&gt;Primer&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-8957739770383230065?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/8957739770383230065/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=8957739770383230065' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/8957739770383230065'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/8957739770383230065'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/06/stroustrups-new-book.html' title='Stroustrup&apos;s new book'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-7461268638221790809</id><published>2009-06-05T20:12:00.005-04:00</published><updated>2009-06-05T20:54:22.999-04:00</updated><title type='text'>IAR, STL and the MSP430</title><content type='html'>Apparently, the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;IAR&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;MSP&lt;/span&gt;430 compiler supports C++'s &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;STL&lt;/span&gt;.  My jaw drops.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In my previous post, I alluded to the desire to try generic programming on a Cortex M3.  Out of curiosity, I wondered whether or not it would be possible/practical to do C++ on an &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;MSP&lt;/span&gt;430.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Well,  after some deep digging I've found that &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;IAR&lt;/span&gt; has "some" C++ support that includes the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;STL&lt;/span&gt;!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;How efficient can it be? Well, I don't like resorting to dynamic memory allocation when I don't have to (and certainly not on an &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;MSP&lt;/span&gt;430) but I decided to give some basic &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;STL&lt;/span&gt; algorithms a try.  I am less concerned about performance than about code size. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;STL&lt;/span&gt; is (undeservedly, IMHO) notorious about being a source of bloat.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is the sample code:&lt;/div&gt;&lt;div&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;#include  &amp;lt;msp430x54x.h&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;#include &amp;lt;numeric&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;#include &amp;lt;functional&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;static volatile int res;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int main( void )&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  int a[] = { 9, 1, 5, 6, 7, 8};&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  // Stop watchdog timer to prevent time out reset&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  WDTCTL = WDTPW + WDTHOLD;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  res = accumulate(a,a+sizeof(a)/sizeof(int),0);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  res = accumulate(a, a+sizeof(a)/sizeof(int), 1, multiplies&amp;lt;int&gt;());&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  return 0;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;This compiles to 250 bytes of CODE, 162 bytes of DATA and 12 bytes of CONST  with default compile settings. (Some of the DATA is pre-sized stack and heap.)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;With the highest optimization settings this compiles to 180 bytes of CODE, 162 bytes of DATA and 12 bytes of CONST.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I am impressed.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Sure this was a contrived test, but I am amazed that I could even do this.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Is this more efficient than a hand written accumulator? No. There are function calls here that wouldn't exist if I were to do it by hand. However, this may scale better than I could muster by hand:  By cherry picking STL algorithms I am choosing to be more type "aware".  I am also avoiding writing stuff like:&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;  for (int i=0; i &amp;lt; sizeof(a)/sizeof(int); i++)&lt;/div&gt;&lt;div&gt;    res += a[i];&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;Simple, right? But do you see the two potential problems? First, I never initialized "res". Second, I introduced another variable "i".  While the STL code has the overhead of function calls, it uses the more space efficient technique of incrementing through "a" rather than indexing.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I'm not planning on using the STL for any real MSP430 work. That would be overkill.  But the Cortex M3 is a different issue...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-7461268638221790809?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/7461268638221790809/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=7461268638221790809' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/7461268638221790809'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/7461268638221790809'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/06/iar-stl-and-msp430.html' title='IAR, STL and the MSP430'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-4487450737544556755</id><published>2009-06-03T22:20:00.003-04:00</published><updated>2009-06-03T22:33:23.532-04:00</updated><title type='text'>C++ on ARM Cortex-M3?</title><content type='html'>I've been wondering how many people use C++ on ARMs. I don't mean C++ as in a "better C", but C++ in full (sans dynamic memory management and exception handling -- both casting non-determinism on systems seeking deterministic behavior).&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The embedded development community/industry seems stuck in C.  (I'm talking truly embedded here -- not Linux gumsticks, not "single board computers", etc.)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;How about C++ with STL (but without vector and other containers that use new/malloc)?&lt;/div&gt;&lt;div&gt;Does this buy you anything?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There has to be an alternative to C.  I wish it was Forth, but there doesn't even seem to be a Forth for Cortex.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I love C, but it doesn't scale very well (when it comes to abstractions and type safety).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;How would generic programming (templates) look on an MCU?  Would I be able to come up with a template that would let me abstract away SPI and UART code?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Is Embedded C++ (with templates) inevitable?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The prospect almost makes me want to buy this: &lt;a href="http://www.digikey.com/scripts/dksearch/dksus.dll?Detail&amp;amp;name=497-6049-ND&amp;amp;enterprise=12"&gt;http://www.digikey.com/scripts/dksearch/dksus.dll?Detail&amp;amp;name=497-6049-ND&amp;amp;enterprise=12&lt;/a&gt; (a Cortex M3 demo/devkit for &lt; $40).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-4487450737544556755?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/4487450737544556755/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=4487450737544556755' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4487450737544556755'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4487450737544556755'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/06/c-on-arm-cortex-m3.html' title='C++ on ARM Cortex-M3?'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-7267937412581451076</id><published>2009-05-26T07:05:00.005-04:00</published><updated>2009-05-26T07:28:23.704-04:00</updated><title type='text'>Biotrophic Parasitic Computing and sensor nets</title><content type='html'>&lt;span class="Apple-style-span"  style="  white-space: pre; font-family:Arial;"&gt;&lt;a href="http://toddbot.blogspot.com/2007/11/biotrophic-parasitism-as-computing.html"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;Biotrophic Parasitic Computing is still fascinating to me.  The parasite needs to be efficient and highly adaptable. Now, in addition, I think the parasite should be able to communicate with others (or a hive host).  Low power sensor net technology comes into play.&lt;br /&gt;The smallest parasite will be the EZ430-T2012. It's tiny and cheap. It will need to be programmed in C (I'm avoiding assembly).Given that most new RF modules (like TI Chipcons and Zigbees) don't require much from outside microcontrollers, I could probablyget away with using a small parasite.&lt;br /&gt;The next step up is the EZ430-RF2500T. It is more expensive (it includes an RF module). It can be programmed in Forth (SwiftX).&lt;br /&gt;Each has its own particular appeal. I want to get back into Forth programming (I can't do this on the T2012 -- not enough RAM),but the T2012 is cheap ($3 a board) and hence has a certain ubiquity.  If I go with C, I can code both using Protothreads as my primary means of abstraction.&lt;br /&gt;The advantage to using Forth on the RF2500T is that it will force me to understand the CC2500 RF module. I can't rely on a C library. I get the same advantage using C on the T2012 since it doesn't have enough space for a C library (like Simpliciti).&lt;br /&gt;&lt;br /&gt;Eventually I'll roll my own board. &lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="  white-space: pre;font-family:Arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-7267937412581451076?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/7267937412581451076/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=7267937412581451076' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/7267937412581451076'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/7267937412581451076'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/05/biotrophic-parasitic-computing-and.html' title='Biotrophic Parasitic Computing and sensor nets'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-4865315296811780748</id><published>2009-05-26T06:18:00.003-04:00</published><updated>2009-05-26T06:34:50.268-04:00</updated><title type='text'>Forth and Microcontrollers</title><content type='html'>My second computer programming language was Forth. My first was BASIC.  I picked up Forth sometime around 1984. I used it first on Commodore 64 and then on a DEC2060 to do some graphic hacks for a Tektronix terminal (am I showing my age now?).  I remember tightly constrained resources. Despite spending a lot of time on a timesharing system (DEC20) I spent my youth trying to get every ounce of performance out of the likes of Commodore 64s and Atari STs.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;By 1989 I  had moved on. I became a UNIX junkie. C became my "base" language and I had adopted TCL as my "scripting" language by 1995.  Over the years I've dipped my toe in many other languages including Perl, Python, Lisp, Smalltalk, Logo, Awk, Java, Lua, C++, Standard ML, etc.  By 2004 my main languages were TCL, C and (sometimes) Awk.  That is, whenever I could get away with using them.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So, now I am at full circle of sorts.  I work with 8/16 bit microcontrollers (tightly constrained resources!) and my primary language is C.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Over the years I kept abreast of what Forth was up to. &lt;a href="http://colorforth.com"&gt;Chuck Moore&lt;/a&gt; is something of a hero of mine. Of course, in the past 20 years I've dabbled in creating my own Forths (mostly in C). &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It was only recently that I've actually came back to actually &lt;span class="Apple-style-span" style="font-style: italic;"&gt;using &lt;/span&gt;Forth to write applications/systems.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Forth is not dead, IMHO.  However,  while I don't think that it will make any resurgence, it does make me wonder why the Microcontroller world is still stuck using C.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-4865315296811780748?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/4865315296811780748/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=4865315296811780748' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4865315296811780748'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4865315296811780748'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/05/forth-and-microcontrollers.html' title='Forth and Microcontrollers'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-1185713975198709329</id><published>2009-04-14T22:36:00.002-04:00</published><updated>2009-04-14T22:49:11.669-04:00</updated><title type='text'>If a tree falls in the forest... (SwiftX Forth)</title><content type='html'>I just finished an initial &lt;span class="Apple-style-span" style="font-style: italic;"&gt;targetting &lt;/span&gt;of &lt;a href="http://forth.com"&gt;SwiftX Forth&lt;/a&gt; to the MSP430F5438.  I had to massage the older MSP430 configuration files that already existed to the "new" MSP430Fx architecture.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I am sure I didn't get everything right, although I managed to at least resize the interrupt vector table and define all of the major ports/registers.  Nothing too impressive, but I managed to get a blinking LED app running :-)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;My original intent for playing with SwiftX Forth was to see if I could utilize it for board level testing within one of my day job projects. We don't have an effective way of poking/peeking all of the peripherals without writing a C app.  With SwiftX Forth we should be able to write a host (PC) resident test app that pokes and peeks through JTAG.  When I say "app" I really mean a handful of Forth words that test various aspects of the board.  Plus there is the added benefit of the interactivity of Forth.  Forth isn't resident on the MSP430, its just on the PC side doing JTAG.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;One thing led to another and I found myself doing an actual "port" of SwiftX to the MSP430F5438 this evening.  It is an eval version of SwiftX I am messing with, but if it proves to be a useful tool for work we will be giving Forth Inc. some money.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I haven't done this much Forth in over 20 years! &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-1185713975198709329?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/1185713975198709329/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=1185713975198709329' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/1185713975198709329'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/1185713975198709329'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/04/if-tree-falls-in-forest-swiftx-forth.html' title='If a tree falls in the forest... (SwiftX Forth)'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-2267679458238430635</id><published>2009-04-10T08:31:00.001-04:00</published><updated>2009-04-10T08:32:55.311-04:00</updated><title type='text'>Quote of the day</title><content type='html'>&lt;p&gt;&lt;/p&gt;&lt;blockquote&gt;"I am a design chauvinist.   I believe that good design is magical   and not to be lightly tinkered with.   The difference between a great design and a lousy one   is in the meshing of the thousand details   that either fit or don't,   and the spirit of the passionate intellect   that has tied them together, or tried.   That's why programming---or buying software---on the basis of   "lists of features" is a doomed and misguided effort.   The features can be thrown together, as in a garbage can,   or carefully laid together and interwoven in elegant unification,   as in APL, or the Forth language, or the game of chess."&lt;/blockquote&gt; &lt;p&gt;&lt;/p&gt;   &lt;p&gt;&lt;span class="author"&gt;&lt;blockquote&gt;-- Ted Nelson&lt;/blockquote&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class="author"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-2267679458238430635?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/2267679458238430635/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=2267679458238430635' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2267679458238430635'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2267679458238430635'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/04/quote-of-day.html' title='Quote of the day'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-8079491421437640043</id><published>2009-04-10T06:34:00.002-04:00</published><updated>2009-04-10T06:45:36.302-04:00</updated><title type='text'>Nuts, renegades and visionaries</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://upload.wikimedia.org/wikipedia/en/8/88/Tobeepornottobeep.jpg"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 300px;" src="http://upload.wikimedia.org/wikipedia/en/8/88/Tobeepornottobeep.jpg" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;The world needs more of them.  If not to force innovation, then to keep the world an interesting place.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Damn that smug Road Runner...&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-8079491421437640043?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/8079491421437640043/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=8079491421437640043' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/8079491421437640043'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/8079491421437640043'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/04/nuts-renegades-and-visionaries.html' title='Nuts, renegades and visionaries'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-6409039215284558913</id><published>2009-03-30T08:04:00.002-04:00</published><updated>2009-03-30T08:17:54.106-04:00</updated><title type='text'>Why embedded operating systems are a dead end...</title><content type='html'>With the (re)rise of concurrency (in particular concurrent processors),  embedded operating systems are a dead end.  This is especially true in robotics. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Why?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Once you get linux (or whatever) running on your embedded hardware (robot?) , you then spend some time getting all of the interrupts right and then compile your high level control language into C (and then compile that into the target MCU) and then... you emulate concurency via threading/tasks. If you go beyond C, you are probably running in a general purpose VM to boot.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For every lift of a mechanical leg, a megabyte or so of code abstraction, translation and OS task switching takes place. Ugh.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;What is the alternative?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Very High Level Languages compiled directly to (or interpreted tightly within a simple VM upon)  hardware with an inter-device messaging protocol.  I want my Lisp/Oz/Haskell/Erlang/etc running on bare metal, baby! (And all programmed from within Emacs running on my laptop ;-)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Of course, Forth programmers already had this 20-30 years ago...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-6409039215284558913?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/6409039215284558913/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=6409039215284558913' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/6409039215284558913'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/6409039215284558913'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/03/why-embedded-operating-systems-are-dead.html' title='Why embedded operating systems are a dead end...'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-4992037968979263750</id><published>2009-03-30T07:46:00.003-04:00</published><updated>2009-03-30T08:03:00.350-04:00</updated><title type='text'>Scratch + iRobot Create?</title><content type='html'>I stumbled upon information regarding the mysterious &lt;a href="http://scratch.mit.edu/forums/viewtopic.php?pid=66921#p66921"&gt;Scratch Extension Protocol&lt;/a&gt;. This is very interesting.  It addresses a deficiency in Scratch that prevented integration with external things such as robots.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In my opinion, one of the greatest hinderances in getting kids involved with robots is the difficulty in programming them. The root of the difficulty is syntax: So you've got an iRobot Create, want to make it move? Use C, Basic, Python or whatever.   Scratch seems like a natural for this.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;With the Extension Protocol, I can write a small piece of middleware that would talk to the Create via wireless (Bluetooth maybe?).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I'm not sure where I would put all of the Create protocol parsing and generation. The easy way would be to place it in the middleware, but there is something "just right" about putting it into a microcontroller that is attached to the Create.  I think I prefer that way because it offers a future hint of autonomy.  Adapting the Scratch Extension Protocol to Create Protocol can be more than a simple protocol translation excercise but evolve into a language of sorts. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Imagine this: &lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;You develop your ScratchCreate script in Scratch, first controlling an on screen Sprite that represents the iRobot Create.  &lt;br /&gt;&lt;/li&gt;&lt;li&gt;You then launch the middleware and continue to debug the script but now control an actual Create wirelessly.  &lt;br /&gt;&lt;/li&gt;&lt;li&gt;Once you've got it working the way you want, you download the Scratch script into the microcontroller running the Create. &lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Voila, you now have an autonomous robot!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This is a powerful concept.  I know there are similiar commercial variations on this, but there is something that resonates differently here for me. I'll have to figure out what and write in more detail as to why.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-4992037968979263750?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/4992037968979263750/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=4992037968979263750' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4992037968979263750'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/4992037968979263750'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/03/scratch-irobot-create.html' title='Scratch + iRobot Create?'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-8719676943351907660</id><published>2009-03-27T12:20:00.003-04:00</published><updated>2009-03-27T13:04:34.585-04:00</updated><title type='text'>Modular Robotics (Bioloid)</title><content type='html'>A couple of years ago I dropped big bucks on a &lt;a href="http://www.robotis.com/zbxe/bioloid_en"&gt;Bioloid &lt;/a&gt;robotic set.  My son has since lost interest in robotics (but I will try to ignite it again in a couple of weeks at &lt;a href="http://www.robotfest.com/index.html"&gt;RobotFest&lt;/a&gt;).  I lost interest in the set due to its cumbersome programming interface and (to me) flaky CM-5 processor brick.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This morning I was talking about robots with a co-worker who has done quite a bit himself in the past. I was curious to see if Bioloids were still being &lt;a href="http://www.crustcrawler.com/products/bioloid/index.php?prod=59"&gt;sold &lt;/a&gt;and... ooh, there are tech manuals now on the smart servos!  Protocol documentation too!  &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I smell a CFT project. In particular, I should be able to pair a Bioloid &lt;a href="http://www.crustcrawler.com/products/bioloid/docs/AX-S1.pdf"&gt;sensor &lt;/a&gt;with an MSP430 or AVR (the CM-5 uses an AVR) and do interesting things.  Maybe I could do this with a few servos too.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Imagine: A Bioloid / Roomba (Create)  hybrid... oooh, think of the potential!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;/todd&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-8719676943351907660?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/8719676943351907660/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=8719676943351907660' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/8719676943351907660'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/8719676943351907660'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/03/modular-robotics-bioloid.html' title='Modular Robotics (Bioloid)'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-2875755076922621625</id><published>2009-03-15T15:51:00.002-04:00</published><updated>2009-03-15T15:57:30.133-04:00</updated><title type='text'>Modular HW</title><content type='html'>A new idea: Throw a bunch of &lt;a href="http://focus.ti.com/docs/toolsw/folders/print/ez430-t2012.html"&gt;MSP430F2012&lt;/a&gt;s at a problem.  I did this recently. Rather than deal with a bigger MCU to handle multiple sensors (which increases software complexity), I have been pairing individual MSP430s with sensors to make them "super sensors".&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This allows me to "perfect" a sensor node, define a common I/O facility (bit banged 2400 baud) and then hook them to a single "controller" MSP430 (maybe a fatter chip).  An example super sensor would be a motion detector consisting of a F2012 and an accelerometer. All of the algorithmic work of determining true "motion" (vs tilt or vibration) would be handled by the dedicated F2012.  &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;More thoughts on this later...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-2875755076922621625?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/2875755076922621625/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=2875755076922621625' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2875755076922621625'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2875755076922621625'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/03/modular-hw.html' title='Modular HW'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-3813692091223409340</id><published>2009-03-09T08:53:00.002-04:00</published><updated>2009-03-09T09:12:48.768-04:00</updated><title type='text'>Back to softer thoughts...</title><content type='html'>I'm pretty burnt out. So, instead of hacking in my home lab, this past weekend I perused books.  I grabbed some (mostly) math and programming books off of the shelf.  It was both a reminder of some of the things I miss since I started doing exclusively embedded work and some of the things I don't miss.&lt;br /&gt;&lt;br /&gt;What I don't miss is the plethora of general purpose programming languages that vie for my attention. What I do miss is the ability to express math concepts (especially geometry) in a high level manner. My lack of education in domain specific languages (specifically: math) is at fault here.&lt;br /&gt;&lt;br /&gt;I think that my "general purpose" language exploration days are truly over. For general purpose programming I don't see what going beyond C and awk (or Tcl) gives me.  Domain specific languages (DSLs) are interesting.  For example, I use Dot (via &lt;a href="http://www.graphviz.org/"&gt;Graphviz&lt;/a&gt;) for producing directed graphs all of the time.  I use &lt;a href="http://scratch.mit.edu/"&gt;Scratch &lt;/a&gt;to work out simple animation/graphics oriented ideas (but, curse you Scratch: no parametization or recursion yet!) and I use it to teach kids how to program.&lt;br /&gt;&lt;br /&gt;Right now, my son is interested in going beyond Scratch, so we may start playing with &lt;a href="http://www.yoyogames.com/gamemaker/"&gt;GameMaker &lt;/a&gt;(a commercial game building tool). That sounds like a DSL to me.&lt;br /&gt;&lt;br /&gt;I've also been toying with doing a DSL in awk that will render graphic primitives (to some screen viewer/plotter via pipes) so I can work through &lt;a href="http://www.amazon.com/Turtle-Geometry-Mathematics-Artificial-Intelligence/dp/0262510375/ref=pd_bbs_sr_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1236604148&amp;amp;sr=8-1"&gt;Turtle Geometry&lt;/a&gt; without having to find/re-learn some Logo variant.&lt;br /&gt;&lt;br /&gt;For work I am using awk to do some quick power consumption calculations.  Excel is what we normally use, but I'd like to see the math all in one view (not by clicking on cells).&lt;br /&gt;&lt;br /&gt;I am considering doing a short DSL in awk to coordinate between Dot/Graphviz state machines and actual code.  I'd like to keep the Dot state machine up to date as the code evolves.&lt;br /&gt;&lt;br /&gt;For now, I am exploring these softer thoughts...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-3813692091223409340?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/3813692091223409340/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=3813692091223409340' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/3813692091223409340'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/3813692091223409340'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/03/back-to-softer-thoughts.html' title='Back to softer thoughts...'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-3785580305405087966</id><published>2009-02-05T21:07:00.006-05:00</published><updated>2009-02-05T21:44:09.395-05:00</updated><title type='text'>MSP430 + FC30 (Orientation Sensor)</title><content type='html'>Recently, I had purchased a few "orientation sensors" (the &lt;a href="http://www.st.com/stonline/products/literature/ds/14752/fc30.htm"&gt;STMicro FC30&lt;/a&gt; -- basically a dumbed down 3 axis accelerometer) from &lt;a href="http://www.sparkfun.com/commerce/product_info.php?products_id=8926"&gt;Sparkfun&lt;/a&gt;. Its a very tiny surface mount (LGA-14 3x5x0.9mm&lt;br /&gt;SMD) package and there is no breakout board yet :-(&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_b0Vq0XuF5vM/SYudkqtjRfI/AAAAAAAAAAs/9PuP2oPVIL0/s1600-h/MSP430.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 209px; height: 157px;" src="http://3.bp.blogspot.com/_b0Vq0XuF5vM/SYudkqtjRfI/AAAAAAAAAAs/9PuP2oPVIL0/s320/MSP430.jpg" alt="" id="BLOGGER_PHOTO_ID_5299502639797716466" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Hmmm, I thought: I have a small tip (0.016")  for my OKi soldering station, so... well, why not?&lt;br /&gt;&lt;br /&gt;So, after a few false starts (and a couple of ruined FC30s later), I decided to mount the chip on the bottom of one of my trusty MSP430F2012 &lt;a href="http://focus.ti.com/docs/toolsw/folders/print/ez430-t2012.html"&gt;EZ430 &lt;/a&gt;boards (3 for $10)&lt;br /&gt;&lt;br /&gt;So, I used a dab of 5-minute epoxy to hold it in place and began to solder jumpers between the EZ430  and the FC30.  Wire-wrap wire (30 AWG) proved to be to thick (and heavy), so I used individual strands of wire from an old test lead cable.&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_b0Vq0XuF5vM/SYuf-UGD57I/AAAAAAAAAA0/Tk_ddAVli00/s1600-h/MSP430%2BFC30.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 320px; height: 240px;" src="http://2.bp.blogspot.com/_b0Vq0XuF5vM/SYuf-UGD57I/AAAAAAAAAA0/Tk_ddAVli00/s320/MSP430%2BFC30.jpg" alt="" id="BLOGGER_PHOTO_ID_5299505279426357170" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I used a 5 Diopter Luxo magnifier lamp so I could see what I was doing  (Oh, those are so nice but pricey. But they are worth it. You position them and they don't move! I have a "low end" KFM1A).&lt;br /&gt;&lt;br /&gt;It took a couple of nights (fora total of 2 hours) and I checked for bridges using my son's microscope at 40X.  It didn't look pretty, but it held.&lt;br /&gt;&lt;br /&gt;Since I was using bare wire strands, I had to be careful not to short them together, so I "layered" epoxy between wires that crossed each other.&lt;br /&gt;&lt;br /&gt;I was very careful not to cover the contacts (yet) with epoxy in case I had to rework the solder. When I got all of the pins soldered (I basically ran the interrupt lines to P1.1, P1.3 and P1.4 on the MSP430) I did a quick continuity check to make sure nothing was shorted.  Next, I wrote a little app to detect orientation and tested it in the IAR debugger. Things were looking good!&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_b0Vq0XuF5vM/SYuiGt7nHHI/AAAAAAAAAA8/p_mhqJmuFBw/s1600-h/Epoxied.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_b0Vq0XuF5vM/SYuiGt7nHHI/AAAAAAAAAA8/p_mhqJmuFBw/s320/Epoxied.jpg" alt="" id="BLOGGER_PHOTO_ID_5299507622824057970" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;(At this point, I must admit that I have prior experience with this sensor -- with help I managed to kludge a similar wiring job but to a 1 inch protoboard, not directly onto an EZ430.  So, I was already familiar with how the FC30 works.)&lt;br /&gt;&lt;br /&gt;Once everything looked good, a added a liberal dollop of epoxy to the bottom of the MSP430, and now I have a nice little development board to play around with orientation sensing.&lt;br /&gt;&lt;br /&gt;Breakout board? We don't need no stinkin Breakout board. (Yeah, right...)&lt;br /&gt;&lt;br /&gt;This was an exercise inspired by the amazing &lt;a href="http://www.youtube.com/watch?v=vYi458oI0-8"&gt;Willard Wigan&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-3785580305405087966?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/3785580305405087966/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=3785580305405087966' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/3785580305405087966'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/3785580305405087966'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2009/02/msp430-fc30-orientation-sensor.html' title='MSP430 + FC30 (Orientation Sensor)'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_b0Vq0XuF5vM/SYudkqtjRfI/AAAAAAAAAAs/9PuP2oPVIL0/s72-c/MSP430.jpg' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-739827910669369785</id><published>2008-11-29T16:47:00.004-05:00</published><updated>2008-11-29T17:01:16.316-05:00</updated><title type='text'>Wireless (portable) MP3 Player</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_b0Vq0XuF5vM/STG4lREIDCI/AAAAAAAAAAg/NtYdnc337WU/s1600-h/mp3.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 233px;" src="http://1.bp.blogspot.com/_b0Vq0XuF5vM/STG4lREIDCI/AAAAAAAAAAg/NtYdnc337WU/s320/mp3.jpg" alt="" id="BLOGGER_PHOTO_ID_5274199589002939426" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Pictured here is a mock up of my "eternally in progress" MP3 player.  It's 3x2 inches.&lt;br /&gt;&lt;br /&gt;This time it is based on a TI MSP430 + 2.4Ghz wireless module (&lt;a href="http://focus.ti.com/docs/toolsw/folders/print/ez430-rf2500t.html"&gt;EZ430-RF2500T&lt;/a&gt;), a &lt;a href="http://www.sparkfun.com/commerce/product_info.php?products_id=519"&gt;Sparkfun MP3 breakout board&lt;/a&gt; and a rechargeable CR2032 Lithium Ion 3V 250mAh button cell battery.&lt;br /&gt;&lt;br /&gt;Two jacks: up top is the headphone / line-out jack and below is the power charger module jack.&lt;br /&gt;&lt;br /&gt;Up on the right is a micro-sd holder for MP3 files.&lt;br /&gt;&lt;br /&gt;The unit is controlled via wireless (player controls and status).&lt;br /&gt;&lt;br /&gt;I am estimating battery life at around 8-10 hrs of play.&lt;br /&gt;&lt;br /&gt;(And, yes, for those of you with sharp eyes, the proto board needs to be isolated from the battery holder because the topside of the board is one continuous plane and would short out the positive oriented holder.)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-739827910669369785?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/739827910669369785/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=739827910669369785' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/739827910669369785'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/739827910669369785'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2008/11/wireless-portable-mp3-player.html' title='Wireless (portable) MP3 Player'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_b0Vq0XuF5vM/STG4lREIDCI/AAAAAAAAAAg/NtYdnc337WU/s72-c/mp3.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-51239651897694719</id><published>2008-10-23T10:36:00.002-04:00</published><updated>2008-10-23T11:00:59.427-04:00</updated><title type='text'>Compromises</title><content type='html'>It's a bit early to make 2009 New Year resolutions, but I am posting this to remind myself of one (professional) resolution I plan to make: No more compromises.&lt;br /&gt;&lt;br /&gt;This doesn't mean that factors won't be considered. What I produce professionally (technically) will be indeed affected by time, monetary costs and, of course, family needs.  But, the feeling that I may have compromised a design or solution due to technical decisions is something I want to put behind me.&lt;br /&gt;&lt;br /&gt;If I were to produce a technological product in 2009, it will be the *best* product I could have produced, given time, monetary costs and family needs.&lt;br /&gt;&lt;br /&gt;I look around at the stuff that I use and like (e.g. &lt;a href="http://www.tivoliaudio.com/product.php?productid=151&amp;amp;cat=266&amp;amp;page=1"&gt;Tivoli radios&lt;/a&gt;, &lt;a href="http://northern-america.beyerdynamic.com/en/consumer-products/products/premiumline.html?tx_sbproductdatabase_pi1%5BshowUid%5D%5BshowUID%5D=174&amp;amp;tx_sbproductdatabase_pi1%5BshowUid%5D%5BbackPID%5D=105&amp;amp;cHash=efe58ee60e"&gt;byerdynamic headphones&lt;/a&gt; and &lt;a href="http://gradolabs.com/product_pages/sr80.htm"&gt;Grado headphones&lt;/a&gt;, &lt;a href="http://www.sennelier.fr/en/oil_pastels.php"&gt;sennelier oil pastels&lt;/a&gt;, &lt;a href="http://www.copicmarker.com/features_multiliner.html"&gt;copic outliners&lt;/a&gt;) and I see them as the wonderful products.  They are just &lt;span style="font-style: italic;"&gt;things&lt;/span&gt;, but as &lt;span style="font-style: italic;"&gt;things &lt;/span&gt;go, they give me pleasure.&lt;br /&gt;&lt;br /&gt;I make &lt;span style="font-style: italic;"&gt;things&lt;/span&gt;. It is what I do, and I don't do enough of it.  However, I also accept too many compromises (either out of indifference, tiredness, or even incompetence on my part).  I have to stop that.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-51239651897694719?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/51239651897694719/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=51239651897694719' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/51239651897694719'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/51239651897694719'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2008/10/compromises.html' title='Compromises'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-955191209441272626</id><published>2008-08-12T09:39:00.005-04:00</published><updated>2008-08-12T10:06:53.922-04:00</updated><title type='text'>AWK based AFT redux?...</title><content type='html'>I've been maintaining the current incarnations of AFT in Perl for over 10 years now.  I haven't updated the code base in almost 2 years now.  I can't brag that is is bug free, but it certainly is stable (at least in some interpretation of that word).&lt;br /&gt;&lt;br /&gt;Every few months I get a question (or two) from new users of AFT.   I have no idea how many people are using AFT, but it is part of the Debian and FreeBSD software archives so it is very easy to download and install on those systems.&lt;br /&gt;&lt;br /&gt;This &lt;a href="http://www.google.com/search?hl=en&amp;amp;safe=off&amp;amp;q=%22This+document+was+generated+using+AFT%22&amp;amp;btnG=Search"&gt;search &lt;/a&gt;indicates that there are at least folks out there using a mostly unchanged AFT to publish documents to the Web. (They haven't bothered to remove the default advertisement).&lt;br /&gt;&lt;br /&gt;I'm pretty much completely out of touch with Perl these days, so I am not very motivated to improve or extend the current AFT.  The codebase has grown complicated and I wince at some of my awkward Perl techniques.&lt;br /&gt;&lt;br /&gt;However, I do have a very decent corpus of AFT documents.  I still use AFT to do general purpose documentation and then there is the previous mentioned cache of AFT documents that can be found through Google.&lt;br /&gt;&lt;br /&gt;If I were to analyze this corpus, would I find a simpler subset of AFT that would do for most uses? And, if I identified that subset, is it time for a rewrite?&lt;br /&gt;&lt;br /&gt;Frankly, I would probably do such a rewrite in AWK (or GAWK).  I'd keep it simple and maybe make it a little more modular (shell pipes?).  I would probably drop the Windows support (although it would still run under cygwin).&lt;br /&gt;&lt;br /&gt;Regarding modularity, I'd probably develop it to run in two phases:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;A single AWK script to produce&lt;/li&gt;&lt;ul&gt;&lt;li&gt;An intermediate markup for Phase 2.&lt;/li&gt;&lt;li&gt;Or vanilla HTML for quick view or incorporation into a larger HTML/CSS framework.&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;A translation from intermediate markup to HTML, LaTeX, etc.&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Similar to what I have now with the current AFT.&lt;/li&gt;&lt;/ul&gt;&lt;/ol&gt;I definitely want to reduce the number of files needed to run AFT. For a minimal run, you would just need AFT.awk and an AWK interpreter.  You could then bind/embed the invocation into your favorite editor (no locating support files or setting environment variables).&lt;br /&gt;&lt;br /&gt;That would be sweet :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-955191209441272626?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/955191209441272626/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=955191209441272626' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/955191209441272626'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/955191209441272626'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2008/08/awk-based-aft-redux.html' title='AWK based AFT redux?...'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-1685709687094430277</id><published>2008-08-12T09:31:00.003-04:00</published><updated>2008-08-12T09:34:56.326-04:00</updated><title type='text'>Interview wiith Alfred Aho on AWK</title><content type='html'>Here is a good &lt;a href="http://www.computerworld.com.au/index.php/id;1726534212;pp;1;fp;4194304;fpid;1"&gt;interview &lt;/a&gt;with Aho on creating AWK.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-1685709687094430277?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/1685709687094430277/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=1685709687094430277' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/1685709687094430277'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/1685709687094430277'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2008/08/interview-wiith-alfred-aho-on-awk.html' title='Interview wiith Alfred Aho on AWK'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-8149194831128515295</id><published>2008-08-06T15:00:00.004-04:00</published><updated>2008-08-06T15:16:02.052-04:00</updated><title type='text'>High Level Languages for Prototyping</title><content type='html'>I want a high level language to try out ideas. Often the ideas I am interested in draws on things such as concurrency, symbolic computing, pattern matching, etc.  I don't need a production capable language. This is just for fiddling around with -- a prototyping language if you will.&lt;br /&gt;&lt;br /&gt;Tcl and Awk were my prototyping languages of choice for the past 10-15 years.  Before that it was Forth and a little bit of Lisp.&lt;br /&gt;&lt;br /&gt;However, I have found that I have five criteria for such a language now. The first three are firm, the last two are desired qualities:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Supports concurrency (lots of little processes/tasks) seamlessly.&lt;/li&gt;&lt;li&gt;Seamless support for Bignums. I don't want to think about silly limitations of native word sizes.&lt;/li&gt;&lt;li&gt;No fencing in (multi-paradigm support is a must!)&lt;/li&gt;&lt;li&gt;Interactive. I don't want to do a edit/compile/run cycle for simple things.&lt;/li&gt;&lt;li&gt;Portable. I want to install it everywhere.&lt;/li&gt;&lt;/ol&gt;Erlang comes to mind, but it fails for #3.  &lt;br /&gt;&lt;br /&gt;Logo is nice, but has too many incompatible variants. StarLogo meets #1, but it looks too busy (especially StarLogo TNG).&lt;br /&gt;&lt;br /&gt;Item 2 sounds a bit ridiculous, but for languages that aren't bound by performance needs, I don't see why I should be trapped in 32/64 bits.  I'll never forget the time, back in 1984, when I typed (fact 120) in Lisp.... oooh.&lt;br /&gt;&lt;br /&gt;I've been meaning to learn Mozart/Oz ever since I read &lt;a href="http://www.info.ucl.ac.be/%7Epvr/book.html"&gt;CTM &lt;/a&gt;a few years back.  It's a wonderful book.  Maybe if I concentrate *real* hard and drop my other CFT projects, I could pick it up again. :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-8149194831128515295?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/8149194831128515295/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=8149194831128515295' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/8149194831128515295'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/8149194831128515295'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2008/08/high-level-languages-for-prototyping.html' title='High Level Languages for Prototyping'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-9156436129387467562</id><published>2008-07-27T15:53:00.002-04:00</published><updated>2008-07-27T16:10:18.341-04:00</updated><title type='text'>Down with Crap!</title><content type='html'>Down with crap devices!  An aside: My kids came home from watching Wall-E with free crappy rubber encased disposable Wall-E watches. Ah, the irony.&lt;br /&gt;&lt;br /&gt;We don't need more crap devices. I am less interested in the new tech gadgets.  I want permanent tech.  I want tech that helps people. You know, stuff that saves lives and makes our lives less miserable.&lt;br /&gt;&lt;br /&gt;I want tech that reduces my reliance on the power grid. I want to reduce my electric bill, not increase it.&lt;br /&gt;&lt;br /&gt;I don't want a PC in my router. I want my router to be a router. I want it to work without a lot of flashing lights. I want it to consume very little power. I want it to go to sleep at night until it gets activity coming from within my home network.&lt;br /&gt;&lt;br /&gt;I want a GPS tracker that lasts (at a low fix rate) months or years on a small non-proprietary battery.&lt;br /&gt;&lt;br /&gt;I want an e-book reader that lasts over a year on one charge.&lt;br /&gt;&lt;br /&gt;I want to come to grips with the fact that battery powered devices that require recharging on a daily basis &lt;span style="font-weight: bold;"&gt;are &lt;/span&gt;part of the energy grid. There is no free ride. It takes power to make power.&lt;br /&gt;&lt;br /&gt;No, wait a minute. I've got it.... I want personal tech that can be effortlessly recharged through solar power.&lt;br /&gt;&lt;br /&gt;I still use my 22 year old Cassio CM-100 &lt;a href="http://www.devidts.com/be-calc/B/_smd13622.jpg"&gt;&lt;/a&gt;calculator. It does hex/octal/binary/decimal and boolean operations. It runs off of solar power.  I've never had to think about replacing a battery or plugging it in for recharging.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-9156436129387467562?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/9156436129387467562/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=9156436129387467562' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/9156436129387467562'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/9156436129387467562'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2008/07/down-with-crap.html' title='Down with Crap!'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-7578000449777255816</id><published>2008-07-27T15:46:00.002-04:00</published><updated>2008-07-27T15:50:17.933-04:00</updated><title type='text'>More MCU Fun.</title><content type='html'>I've been looking into the new &lt;a href="http://www.ti.com/corp/docs/landing/msp430f5xx-launch/index.htm?DCMP=MSP430F5xx&amp;amp;HQS=Other+OT+5xx"&gt;MSP430F5xx.&lt;/a&gt; It looks really nice.  I ordered the development kit. Now I have to figure out what to do with it. ;-)&lt;br /&gt;&lt;br /&gt;/todd&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-7578000449777255816?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/7578000449777255816/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=7578000449777255816' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/7578000449777255816'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/7578000449777255816'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2008/07/more-mcu-fun.html' title='More MCU Fun.'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-2710441132453694856</id><published>2008-04-29T22:42:00.003-04:00</published><updated>2008-04-29T22:49:36.196-04:00</updated><title type='text'>New Literate Programming Hack: Knit</title><content type='html'>I can't really use CWEB or other &lt;span style="font-style:italic;"&gt;disruptive &lt;/span&gt;&lt;a href="http://literateprogramming.com"&gt;Literate Programming&lt;/a&gt; tools at work. I want some of the benefits that Literate Programming brings, but I can't take the baggage (at least not at work). &lt;br /&gt;&lt;br /&gt;Yet, when I code in a LP style, I tend to be much more precise and correct. My code does tend to be less buggy. I think it is because it forces me to really think about my code in such a way that I want to be able to explain (and understand) every variable and every line. After all, the code becomes something I have to talk about, not just pump out. &lt;span style="font-style:italic;"&gt;Do I really need a variable here? Do I really understand how that library macro works?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;So, a couple of nights of hacking and I have yet-another-pitiful-LP-inspired-code-markup technique. I call it &lt;a href="http://www.maplefish.com/todd/knit.html"&gt;Knit&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;It is written in gawk and embeds its own documentation in the source code comments. I hope to have some C examples soon.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-2710441132453694856?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/2710441132453694856/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=2710441132453694856' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2710441132453694856'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2710441132453694856'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2008/04/new-literate-programming-hack-knit.html' title='New Literate Programming Hack: Knit'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16578308.post-2707333850445909272</id><published>2008-04-28T22:29:00.003-04:00</published><updated>2008-04-28T22:38:51.936-04:00</updated><title type='text'>New Knuth Fascicles..</title><content type='html'>With Donald Knuth being &lt;span style="font-style:italic;"&gt;trashed&lt;/span&gt; fairly recently on reddit and various blogs (mostly due to a recent &lt;a href="http://www.informit.com/articles/article.aspx?p=1193856"&gt;interview&lt;/a&gt;), I realized that I haven't perused his site in a while.&lt;br /&gt;&lt;br /&gt;Oooh. More &lt;a href="http://www-cs-staff.stanford.edu/~uno/news.html"&gt;fasciles&lt;/a&gt;!&lt;br /&gt;&lt;br /&gt;In particular, I'll be trying to digest some of &lt;a href="http://www-cs-staff.stanford.edu/~uno/fasc1a.ps.gz"&gt;this&lt;/a&gt; one tonight.&lt;br /&gt;&lt;br /&gt;(I am a &lt;span style="font-weight:bold;"&gt;huge&lt;/span&gt; fan of his work. &lt;a href="http://www-cs-staff.stanford.edu/~uno/lp.html"&gt;Literate Programming&lt;/a&gt; is my all time favorite technical book. I read it back in 1992 and it has completely screwed me up for life. I read it whenever I get burnt out and need some inspiration. It has always been my model for excellence for both it's content and style.)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16578308-2707333850445909272?l=toddbot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toddbot.blogspot.com/feeds/2707333850445909272/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16578308&amp;postID=2707333850445909272' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2707333850445909272'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16578308/posts/default/2707333850445909272'/><link rel='alternate' type='text/html' href='http://toddbot.blogspot.com/2008/04/new-knuth-fascicles.html' title='New Knuth Fascicles..'/><author><name>Todd Coram</name><uri>http://www.blogger.com/profile/00551771132277351922</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://maplefish.com/todd/pirate.jpg'/></author><thr:total>2</thr:total></entry></feed>
