Your leaking thatched hut during the restoration of a pre-Enlightenment state.

 

Hello, my name is Judas Gutenberg and this is my blaag (pronounced as you would the vomit noise "hyroop-bleuach").



links

decay & ruin
Biosphere II
Chernobyl
dead malls
Detroit
Irving housing

got that wrong
Paleofuture.com

appropriate tech
Arduino μcontrollers
Backwoods Home
Fractal antenna

fun social media stuff


Like asecular.com
(nobody does!)

Like my brownhouse:
   simple shell environment
Sunday, August 10 2008
I made a lot of advances with the Arduino-based solar sufficiency controller today. For starters, I dealt with the limitations of a very simple C-based development environment, one where strings are only grudgingly supported and there are no luxuries like explode, substr, or even concatenation. One of the many orders of business was to write some code to take a C longword and turn it into a string of bytes so I could store it in the EEPROM. If this had been the PHP environment, I might have handed the longword to function that returned an array of bytes, and then I would have had another function store them. But in the world of Arduino, it's best to let your complicated functions handle all the details and return void (also known as nada). Breaking a longword into bytes requires use of a power function, something to raise one number to the power of another. The Arduino environment has such a function, but I found that by writing my own, I saved scads of flash memory.
A lot of my code today was written in the form of a simple parser that could pick out characters in the serial stream coming into the Arduino and then use that data to write, read, display, and clear information in the EEPROM. My code became a simple shell environment allowing me to query the Arduino for things like morning switch-on logs and extreme conditions measured by the sensors.
By this evening, though, I was experiencing spurious behavior that I soon attributed to insufficient memory. When the Atmega168 in the Arduino runs out of memory, it just barrels into whatever used memory is next in line, and all sorts of bad things happen. It turned out that most of this could be dealt with by pulling the string literals out of their homes within various functions, where (for reasons that elude me) they occupy both flash and static memory, one copy in each.


For linking purposes this article's URL is:
http://asecular.com/blog.php?080810

feedback
previous | next