Category: Programming

  • ISP programmer for the STC89C51 and STC89C52

    I couldn’t find an ISP (programmer) for the STC89C52RC that worked with modern versions of Windows. I found several programmers that work with other chips in the STC range. I did find one that worked on Windows XP, and with some hacking got it to work with Windows 7; however I had no luck with…

  • Fast, small, and simple Arduino SPI RAM chip routines.

    The 8-pin chip, 23LC1024, is a good candidate for adding extra RAM to simple Arduinos such as the Uno, Nano, Mini.  It provides 128K of RAM (the ATmega328 chip that these Arduinos use only has 2K of internal RAM). The chip works at 5V (anything from 2.5V to 5.5V) and uses SPI so it only…

  • Untangle, Planarity.

    I’ve been writing some code (in Java) to solve this fun puzzle.  I’ve played the puzzle for many years – it’s part of the excellent and free Simon Tatham’s Portable Puzzle Collection which has been available on many platforms for ages and has recently been ported to Android too.  Untangle was inspired by Planarity, written…

  • ATmega328P-PU 12MHz bootloader

    It took me an embarrassingly long time to get a 328 with a 12MHz crystal working so that it would allow a normal (serial / FTDI) upload from the Arduino IDE. There are a few older guides around but I didn’t find one that used the newer optiboot bootloader. If you don’t want to compile…

  • Controlling the Raspberry Pi camera from C

    I wanted to be able to stop and start the camera driven by events instead of just calling raspivid to record for a preset time. My code is really just a simple wrapper around raspivid using the SIGUSR1 option to stop the video under program control rather than after a preset time. The example main()…

  • Flash Rubik Cube Simulator

    Above is a snapshot image.  Here’s the real thing. It works for any size of cube from 2 x 2 x 2 up to 11 x 11 x 11.  Actually, 11 is an arbitrary limit – the same code would work for any size of cube.  Use the little + and – buttons up in the top…

  • The Minimum Attack Problem

    Place five queens on a chess board so that every square on the board is attacked.  It’s an old and famous problem; there are lots of solutions and it’s pretty easy to find one.  Try it for yourself and see! Now try using just three queens and two rooks.  Not so easy this time; the…