Example program connecting a MAG3110 3-axis magnetometer to a Picaxe 08M2.
The Mag3110:
has an I2C interface
is very sensitive (0,1uT resolution, while the Earth's magnetic field is 50uT strong around here (and pointing almost straight down, about 65-70 degrees downwards, didn't realise that)...