ma7455 i2c code

hi, I've got this code and am trying to get the x value from the accelerometer but in debug the value always equals 0.
I've used an oscilloscope to check the circuit and its fine, and im certain the addresses are right.
Looking at the code can anyone tell me whats wrong with it?

#include <plib.h>

#define SYS_FREQ 		(40000000L)
// #define CCLK(60000000) //8Mhz Osc on Explorer16 board (pll 8 / 2 * 15)
#define PBCLK (SYS_FREQ/8)
//#define Fsck375000
#define BRG_VAL (PBCLK/2/SYS_FREQ)
#define Nop() asm( "nop" )

unsigned char x, y, z;
int lsbx;
int lsby;
int lsbz;
 main() {
	SYSTEMConfig(SYS_FREQ, 0);
        // Set Periph Bus Divider 60MHz / 8 = 9MHz Fpb
        mOSCSetPBDIV( OSC_PB_DIV_8 );
	mPORTAClearBits(BIT_0);					//Clear bits to ensure light is off.
	mPORTASetPinsDigitalOut(BIT_0);			//Set port as output

        unsigned char SlaveAddress;

        TRISBbits.TRISB8 = 0;
        TRISBbits.TRISB9 = 0;

        //Enable channel
        OpenI2C1( I2C_EN, BRG_VAL );
        SlaveAddress = 0x1d;//0b1010000 Serial EEPROM address


        IdleI2C1();
        StartI2C1();
        IdleI2C1();
        x = 0x1d;
        x <<= 1;
    //    x &= 0b11111110;
        MasterWriteI2C1(x);	 //select slave $1D
        IdleI2C1();
        MasterWriteI2C1(0x6);	 //write to $06 x
        IdleI2C1();
        RestartI2C1();
        IdleI2C1();
        x |= 1;
        MasterWriteI2C1(x);	 //read $1D
        IdleI2C1();
   //     lsb = MasterReadI2C1();
        if (DataRdyI2C1())
        {
            lsbx = MasterReadI2C1();
        }
        NotAckI2C1();
        IdleI2C1();
        StopI2C1();



        for(;;){



        }
 }

Hi, Not sure about you code, but here is a working example:

http://arduino-info.wikispaces.com/accelerometer-MMA7455

just wondering, does arduino software only work on an arduino board, or can it work on other microstick development boards?

What are "Microstick Boards"?

If you are using some ATMEL chip, see MMA_7455.cpp in the library for how the code was done; you could probably adapt it.