Main Site Documentation

SPI driver for ADIS16227


#1

Hi:
I am writing the SPI driver for ADIS16227.
http://www.analog.com/static/imported-files/data_sheets/ADIS16227.pdf

I refer to the code of GHI�s Accelerometer Extension driver.
I have some questions.
In that code, the value is 1 byte. But In the data sheet of ADIS16227, the address is one byte and the value is two bytes.
How do I solve it?
Thank you very much.

Lin


#2

Hi Gus, could you help me?
The address and value are both one byte in GHI’s code.

static private byte[] write = new byte[2];

But in ADIS16227, the adress is 0x02 and the value is 0x0000, for example.


static private void WriteRegister(byte address, byte value)
            {
                write[0] = address;
                write[1] = value;
                _spi.WriteRead(write, read);
 
            }



#3

Not sure what is your question but the word “address” can be confusing here. Why? Because “address” on I2C is what you use to access the device. It is 7 bit number. Now, in the code we have also used the word address but that is the register address inside the chip not the I2C address of the chip


#4

SPI.WriteRead has two overloads. One takes a byte and one takes a short (if I have not mistaken).
So declare your address and value to short and it shall be good.