My code work.
Reading the values, but I do not know if the correct.
I modifi code, i read x, y, z accel,, x, y, z gyro,, and x,y,z temperature.
I increase delay slightly.
Here is code: code work read values - values ??probably are not all right
/*
Arduino Duemilanove and Tri axis senzor ADIS16354
Datasheet:
http://www.analog.com/static/imported-files/data_sheets/ADIS16354.pdf
pin 10 CS - SS - vo?ba SPI zariadenia
pin 11 DIN - MOSI - Master-out, Slave-in - digitálny vstup, slúži na zápis dát z Arduina do senzora
pin 12 DOUT - MISO - Master-in, Slave out - digitálny výstup, slúži na ?ítanie dát zo senzora do Arduina
pin 13 SCK - SCLK - Serial clock - nastavenie hodín a frekvencie
*/
#include <SPI.h>
int ss=10; // vyberieme SPI zariadenie, kedže sa používa iba jedno bude stále táto hodnota nastavená na 10
byte ax, ay, az;
byte gx, gy, gz;
byte tx, ty, tz;
word datax, datay, dataz;
word dataxg, datayg, datazg;
word dataxt, datayt, datazt;
word data;
void setup()
{
Serial.begin (9600);
pinMode(ss, LOW); // používa sa pin 10
SPI.begin(); // inicialuzuje sa SPI
SPI.setDataMode(SPI_MODE3);
SPI.setBitOrder(MSBFIRST); // is MSBFIRST correct ??
// senzor posle najskor MSB (most significant byte) bit ako prvý
digitalWrite (SMPL_PRD, 0x0A);
//SPI.transfer(0x0a); // set the IMU to read so the next command will get valid data
//SPI.transfer(0x0b);
}
void loop()
{
//=================================================
// Accelerometer read data
//=================================================
//read x accel
digitalWrite(ss,LOW);
delayMicroseconds(160);
ax=SPI.transfer(0x0a);
delayMicroseconds(160);
digitalWrite(ss,HIGH);
datax=(ax<<8);
Serial.print("X Accel: ");
Serial.print(datax, DEC);
Serial.print("\t");
delay(200);
//=================================================
//read y accel
digitalWrite(ss,LOW);
delayMicroseconds(160);
ay=SPI.transfer(0x0c);
delayMicroseconds(160);
digitalWrite(ss,HIGH);
datay=(ay<<8);
Serial.print("Y Accel: ");
Serial.print((ay<<8), DEC);
Serial.print("\t");
delay(200);
//=================================================
//read z accel
digitalWrite(ss,LOW);
delayMicroseconds(160);
az=SPI.transfer(0x0e);
delayMicroseconds(160);
digitalWrite(ss,HIGH);
dataz=(az<<8);
Serial.print("Z Accel: ");
Serial.println((az<<8), DEC);
delay(200);
//=================================================
// Gyroscope read data
//=================================================
//read x gyro
digitalWrite(ss,LOW);
delayMicroseconds(160);
gx=SPI.transfer(0x04);
delayMicroseconds(160);
digitalWrite(ss,HIGH);
dataxg=(gx<<8);
Serial.print("X Gyro: ");
Serial.print(dataxg, DEC);
Serial.print("\t");
delay(200);
//=================================================
//read y gyro
digitalWrite(ss,LOW);
delayMicroseconds(160);
gy=SPI.transfer(0x06);
delayMicroseconds(160);
digitalWrite(ss,HIGH);
datayg=(gy<<8);
Serial.print("Y Gyro: ");
Serial.print((gy<<8), DEC);
Serial.print("\t");
delay(200);
//=================================================
//read Z gyro
digitalWrite(ss,LOW);
delayMicroseconds(160);
gz=SPI.transfer(0x08);
delayMicroseconds(160);
digitalWrite(ss,HIGH);
datazg=(gz<<8);
Serial.print("Z Gyro: ");
Serial.println((gz<<8), DEC);
delay(200);
//=================================================
// Temperature read data --- ?ítanie teploty
//=================================================
//read x temp
digitalWrite(ss,LOW);
delayMicroseconds(200);
tx=SPI.transfer(0x10);
delayMicroseconds(200);
digitalWrite(ss,HIGH);
dataxt=(tx<<8);
Serial.print("X Teplota: ");
Serial.print((tx<<8), DEC);
Serial.print("\t");
delay(200);
//=================================================
//read y temp
digitalWrite(ss,LOW);
delayMicroseconds(200);
ty=SPI.transfer(0x12);
delayMicroseconds(200);
digitalWrite(ss,HIGH);
datayt=(ay<<8);
Serial.print("Y Teplota: ");
Serial.print((ty<<8), DEC);
Serial.print("\t");
delay(200);
//=================================================
//read z temp
digitalWrite(ss,LOW);
delayMicroseconds(200);
tz=SPI.transfer(0x14);
delayMicroseconds(200);
digitalWrite(ss,HIGH);
datazt=(tz<<8);
Serial.print("Z Teplota: ");
Serial.println((tz<<8), DEC);
delay(200);
}
Here is the result when the sensor is in peace:
X Accel: 0 Y Accel: 0 Z Accel: -16640
X Gyro: 60928 Y Gyro: -18688 Z Gyro: -27392
X Teplota: -32768 Y Teplota: 512 Z Teplota: -32768
X Accel: 15616 Y Accel: -32768 Z Accel: 13568
X Gyro: 48896 Y Gyro: -17152 Z Gyro: -16640
X Teplota: -512 Y Teplota: -32768 Z Teplota: 1280
X Accel: 32768 Y Accel: 14848 Z Accel: -32768
X Gyro: 9728 Y Gyro: -18688 Z Gyro: -31488
X Teplota: -16640 Y Teplota: -256 Z Teplota: -32768
Here is the result when the sensor moves:
X Accel: 0 Y Accel: 0 Z Accel: 0
X Gyro: 64512 Y Gyro: 5632 Z Gyro: -16384
X Teplota: -21760 Y Teplota: -16384 Z Teplota: -24064
X Accel: 49152 Y Accel: 15616 Z Accel: -16384
X Gyro: 35328 Y Gyro: -1280 Z Gyro: -25088
X Teplota: -14592 Y Teplota: -17408 Z Teplota: -16384
X Accel: 16640 Y Accel: -16384 Z Accel: 14592
X Gyro: 64512 Y Gyro: -1024 Z Gyro: -768
X Teplota: -29440 Y Teplota: -2048 Z Teplota: 0
X Accel: 0 Y Accel: 15616 Z Accel: 0
X Gyro: 0 Y Gyro: 0 Z Gyro: 0
X Teplota: 0 Y Teplota: 0 Z Teplota: 0
X Accel: 0 Y Accel: -16384 Z Accel: 14592
X Gyro: 63744 Y Gyro: 2048 Z Gyro: 0
X Teplota: 0 Y Teplota: -3072 Z Teplota: -12032
Almost the same values.
Here is arduino code http://arduino.cc/forum/index.php/topic,13298.0.html
There is described the function which reads 8 bits and 16 bits back.(I tried this function but without result)
It is the fifth report.
BTW: I find site Gammon Forum : Electronics : Microprocessors : Connecting SRAM to your microprocessor using SPI
I try code from this side modify to my senzor. Here is code:
byte ss=10; //CS pin 10
byte dataxg;
#include <SPI.h>
#define XGYRO_OUT 0x04
void xgyro_out (const byte ss, unsigned int address, byte * dataxg, unsigned int length)
{
if (length == 0) // don't bother if nothing to do
return;
digitalWrite (ss, LOW); // select device
SPI.transfer (XGYRO_OUT); // read mode
SPI.transfer (address >> 8); // high-order address byte
SPI.transfer (address & 0x04); // low-order address byte
for ( ; length ; --length)
*dataxg++ = SPI.transfer (0); // data byte
digitalWrite (ss, HIGH); // deselect device
}
void setup()
{
Serial.begin (9600);
pinMode(ss, HIGH); // používa sa pin 10
SPI.begin(); // inicialuzuje sa SPI
SPI.setDataMode(SPI_MODE3);
SPI.setClockDivider(SPI_CLOCK_DIV64);
SPI.setBitOrder(MSBFIRST);
}
void loop()
{
char buf [100];
xgyro_out (ss, 100, (byte *) buf, sizeof buf);
Serial.print("X Gyro: ");
Serial.print(buf);
Serial.println("\t");
delay(200);
}
Code work, but results are very wild 
X Gyro: ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÂ
X Gyro:
X Gyro:
X Gyro: ÿ
X Gyro:
X Gyro: ÿ
X Gyro:
X Gyro: À