You could also try looking at the mother of Luxdrv here.
You can see how I implemented the battery readout in Tido's program. Now you can also switch the memory on/off (done in SOS mode).