William Anthony Richard Godbolt
It has been rather a busy few weeks for us! As I’ve mentioned in a previous post, my wife Ness and I were expecting our first child in mid July.
However, on the 12th of June, 2008, William Anthony Richard Godbolt was born. He was a few weeks early and weighed only 1.88kg (4lb 2oz), but he breathed unassisted straight away and has been feeding brilliantly. He’s already nearly 2kg, and shows no sign of stopping!
We’d like to thank all our family and friends for their help, well wishes and lent and donated baby things. William’s early arrival was such a surprise for us we were caught somewhat off-guard — so especial thanks to our parents and siblings for buying up half of Mothercare on our behalf!
William gets some early coding in.
Ness and I are absolutely over the moon, and are enjoying every moment we are spending getting to know our new son! More pictures here.
Filed under: Blog
Posted at 18:30:00 BST on 23rd June 2008.
LCD screen hackery
Although I haven’t touched my Weebox project very much recently, I’ve been thinking about the LCD display. It’s a one-bit-per-pixel 320×64 display, with a simple controller (the HD61830). The controller has 8KB of on-board video RAM, which is more than enough to hold the 320×64÷8 = 2560 bytes of screen. The controller allows me to set and clear bits in bytes of screen memory, or set bytes to specific values. It also has a register which controls the start of the displayed image in RAM.
My driver code currently just points the start of screen to the beginning of the screen memory, and then manipulates the first 2560 bytes of the memory to draw the text and images. However, I’ve had an idea to get something out of those remaining 5632 bytes.
The LCD display is pretty unresponsive — it takes a noticeable amount of time to go between black and white, and it occurred to me that I might be able to take advantage of this: If I were to quickly toggle pixels between on and off then I might be able to simulate shades of grey.
However, writing to the screen memory is pretty slow and CPU intensive — over a microsecond per byte, with the CPU managing the process of bringing enable lines and address lines up and down to talk to the LCD controller. I wouldn’t be able to do much else at the same time if I were to just continuously flip pixels on and off individually.
What I plan on doing instead is upload multiple images of the screen into the LCD display’s memory, and then alter the start of screen to quickly switch between them. For example, imagine I have two images in video RAM, and then I change the start of screen to show one image, and then the other, flipping between them say ten times a second. Any pixel that’s set to be on in both images will remain on all the time, and similarly any pixel that’s off will remain off. However, if a pixel is on in one image and off in the other, then its colour will be flipped back and forth between black and white ten times a second. I’m hoping this will give me a kind of 50% grey shade.
As it happens there’s enough room to fit three screens in video memory. Each screen would be like a plane in a three-bit-per-pixel bit plane image. Initially I thought I’d show each screen image for the same amount of time, which would make the 8 possible values for each pixel correspondingly:
| Value | On/off pattern | Duty Cycle |
|---|---|---|
| 0 | ___ | 0% |
| 1 | __* | 33% |
| 2 | _*_ | 33% |
| 3 | _** | 67% |
| 4 | *__ | 33% |
| 5 | *_* | 67% |
| 6 | **_ | 67% |
| 7 | *** | 100% |
Using this encoding means 1, 2 and 4 are all “stay on 33% of the time”, and 3 and 6 are “stay on 67%”, but at slightly different phases. I imagine there would be no visible difference the phases, so this make this encoding pretty redundant — I have eight values but only three possible shades.
My next idea was to hold the first image for 4N units of time, the next for 2N units, and ther last for N units. That way I actually get eight different amounts of “on time” per pixel:
| Value | On/off pattern | Duty Cycle |
|---|---|---|
| 0 | _______ | 0% |
| 1 | ______* | 14% |
| 2 | ____**_ | 29% |
| 3 | ____*** | 43% |
| 4 | ****___ | 57% |
| 5 | ****__* | 71% |
| 6 | ******_ | 86% |
| 7 | ******* | 100% |
This looks great on paper – I should be able to in theory make a one-bit-per-pixel display display eight different shades of grey.
Except… in reality it won’t work like that. The response curve of an LCD display is non-linear, so I’ll need to experiment with the display to work out appropriate settings. For example, does being on for 14% of the time actually correspond to a useful “light grey”? Also, it could be that I can’t change the screen address often enough to make this viable. Or having seven time steps makes the display too flickery.
Once I get the Weebox working again, I’ll run some tests and post what I find. And then I need to think of what to do with the last 512 bytes of unused screen RAM…
Filed under: Coding
Posted at 14:30:00 BST on 5th June 2008.
The beginning of the end for Windows XP
On Friday last week I finally had the last straw with Windows. Under duress I had installed Service Pack 3 on my main PC to try and fix an issue I was having. It not only didn’t help the issue, but it meant my Remote Desktop stopped working. I spent quite some time trying to fathom what had gone wrong, but to no avail.
Later that day I awoke my laptop from standby and was informed that I had to reboot to install some critical updates. The dialog box gave me two options: “Reboot Now” or “Reboot Later”. Unfortunately, for reasons I don’t quite understand, the “Reboot Later” option was greyed out.
Now I don’t know about you, but at the point where a computer decides it knows best about whether to suddenly shut down all your open applications and reboot, it’s time to find a new operating system. I don’t think I’m alone in this, it seems pretty fashionable to bash Microsoft at the moment, what with the cockup of the Vista launch.
For some time I’ve been humming and harring about installing Ubuntu GNU/Linux. It’s been around for ages, I know, and has been pretty well received by everyone. My existing Linux boxes (relegated to the loft) have always run Debian — and I’ve been very happy with their distribution — but I thought I’d see what all the buzz was about and install a more contemporary system. Although I had ensured my BackupPC backups of all my data were up to date, just to be paranoid I also took a VMWare snapshot of my XP machine before I hosed it completely. That took a few hours, as I was storing the data on my relatively slow file server. It was a surreal experience to power it down, and then as a test bring up a virtual equivalent on my laptop. I wouldn’t recommend running a virtual OS’s disks over Samba on a wireless network though — it took about 15 minutes to boot, and about the same to shut down, all I/O bound.
Safely backed up, I burnt the Ubuntu installer to CD and rebooted. First problem: my RAID setup.
When I built my home computer I was sure that the majority of the time spent compiling was actually waiting for I/O. To try and speed up my builds I splashed out on a couple of 10,000 RPM Raptor disks, and set them up in RAID 0 using the NVidia RAID BIOS. I’m not entirely convinced it was worth it, although I did get some pretty benchmark graphs.
The RAID turned out to be a right sticking point — it’s not supported by the
Ubuntu installer. A bit of trawling around turned up this article,
which was a great help, though a little out of date. I wish I had written
down what I actually ended up doing to get everything working as I’m sure
it would make this post a lot more useful, but it was about 3:30am that
everything fell together and I wasn’t at my most lucid. The one thing I
remember is that the installer let me mistakenly mark my /boot partition as
being swap, which didn’t stop it formatting it as ext3 and installing
everything fine, but did stop grub from installing with the very
unhelpful error message Grub Error 15 - Partition Table Invalid. So, if
you see that during grub installation, check your partitions are marked
as the correct type.
Anyway, cutting a long story short, I now have a very shiny Ubuntu installation. I’m very pleased with it so far, all the whizz-bang windowing effects aren’t annoying me (yet), and the programs installed by default seem very good. Bear in mind that although I’ve been using and hacking about with Linux for over ten years, this is the first time I’ve actually used it in a windowed environment. My idea of a Linux box is still something you see at the end of a PuTTY terminal, so I’ve got a lot to learn.
For now, I’m keeping the laptop on Windows, but the long-term plan is to move that over to Linux too, once I’ve checked Ness can still VPN into her work with it.
Filed under: Blog
Posted at 23:00:00 BST on 1st June 2008.
Two weeks of relaxing
I’m writing this on my mobile from a beach in Agia Napa. It’s blisteringly hot and there are only faint wisps of cotton wool clouds in the sky.
Sadly, this is our last day here. We’ve had two weeks of relaxation — our last before Baby Godbolt comes along and changes our lives forever. We’ve visited the hotel where we got married over two years ago and spent a lovely evening in its Cliffside bar. We’ve eaten out more than we ought to have, spent lazy day after lazy day on the beach and slept endlessly. It’s been fantastic!
Ness chills out in the Cliffside bar at the
Grecian Park Hotel
I’ve even had time to do a spot of hobby coding; mainly playing about with Google’s AppEngine and doing a bit of Python coding on an Amazon S3-based backup solution I’ve been thinking about. I also took some time going over some old algorithms that I perhaps should use more often. I lectured Ness on the wonders of different sorting techniques, trees and even assembly versus compiled versus interpreted code. As ever, she was patient and humoured me while I blathered on. It really does help though — the very act of explaining something to someone else is great for showing up weaknesses in one’s own understanding.
Now we’re soaking up our last few rays of sun before going back to the flat to pack. Next time we go on holiday we’ll have a baby with us!
Filed under: Blog
Posted at 14:30:00 BST on 10th May 2008.