SPI interface code for HMC5983

Hi,

I have a HMC5983 breakout board.

Can any one please guide me to interface the sensor with the Arduino uno .

An example code of how to start with SPI interface as this sensor has two mode of operation.

And why is that most people prefer I2C communication than spi for sensor interface.

Thanks.

Regards,
Vikash.

HMC5983_3_Axis_Compass_IC.pdf (852 KB)

hmc5983.PDF (32.9 KB)