HM55B Compass Module Problem

Hi,

I can't get the Hitachi HM55B Compass Module working with my Arduino Duemilanove (surface mount ATMega328) and could use some help.

I started with the code for the HM55b posted on playground at playground/Main/HM55B (sorry, forum poster wouldn't let me post full link since I'm a newbee, so I had to strip it down - it's located off of main arduino.cc website).

I added this code to my project, and wired my circuit as shown on that page.

I made a few minor modifications to the original source code:

Change 1) Changed pin locations to three open pins on my board:

Original: byte CLK_pin = 8; byte EN_pin = 9; byte DIO_pin = 10;

Current: byte CLK_pin = 10; byte EN_pin = 12; byte DIO_pin = 13;

Change 2) Renamed loop() routine in the sample code to read_compass() so I could add this source to my main project (which already contains the main loop() routine), and I now call read_compass() from my main loop() routine when user sends a serial command to do so.

NOTE that I have not calibrated the chip, nor am I picking true N S E W directions for my rotation stop points for this test. However, I would expect the angle, regardless of what it is, to change by about 90 each time (or range between -180 and 180). The results I got are not what I expected. Am I missing something?

The Test:

I position the device flat on a table at Angle #1 (12 o'clock) and rotate the device 90 degrees clockwise each time, taking 4 readings at each location (12, 3, 6, 9, and then 12 o'clock again).

The Results:

// First reading always returns the following (code reading too early ?? Status indicates still in progress):

0 0 0 0

// 12 o'clock reading 12 59 -200 73 12 61 -193 72 12 61 -200 73 12 59 -193 73

// 3 o'clock reading 12 -23 -224 95 12 -23 -217 96 12 -21 -217 95 12 -21 -225 95

// 6 o'clock reading 12 -29 -88 108 12 -27 -88 107 12 -33 -81 112 12 -31 -89 109

// 9 o'clock reading 12 51 -57 48 12 51 -57 48 12 49 -64 52 12 51 -65 51

// 12 o'clock reading 12 53 -201 75 12 55 -201 74 12 53 -193 74 12 53 -192 74

Can anyone help me out / know what might be going wrong?

Is my assumption as to what the output data from this test should look like incorrect ?

Thanks in advance for any thoughts you might have.