Problem SPI using ADC

Hello
I am using arduino nano and try to interfacing with adc 12-bit datasheet >> http://www.analog.com/static/imported-files/data_sheets/AD7887.pdf
The analog input of adc is connected to a potentiometer,in this way ImageShack - Best place for all of your image hosting and image sharing needs
The value for reading adc is shown on serial monitor but it is wrong!!
here is my code

#include <SPI.h>
int ss = 10;
unsigned int adcValue;
byte byte1;
byte byte2;
void setup() {
  pinMode (ss, OUTPUT);
    SPI.begin(); 
    SPI.setBitOrder(MSBFIRST);
    Serial.begin(9600);
}
void loop(){
  digitalWrite(ss,LOW);
  SPI.transfer(32);
  byte1=0;
  byte2=0;
  byte1=SPI.transfer(0);
  byte2=SPI.transfer(0);
  adcValue=byte1<<8;
  adcValue=adcValue|byte2; 
  adcValue=adcValue/16;   
  digitalWrite(ss,HIGH);
  Serial.println(adcValue,DEC);
  delay(100);
}

thanks

In what way is the value shown on the serial monitor “wrong”?!?

You are setting bit 5 of the control register which turns off the internal 2.5V analog reference but you show nothing connected to the reference pin.

"The control register on the AD7887 is an 8-bit, write-only register. Data is loaded from the DIN pin of the AD7887 on the rising edge of SCLK. The data is transferred on the DIN line at the same time as the conversion result is read from the part. "

You are not capturing the 8 bits returned from the ADC at the same time you send the value 32 to the control register. Try:

  byte1 = SPI.transfer(32);
  byte2 = SPI.transfer(0);

I want to values,??displayed on the serial monitor,change by turning the potentiometer in a range of 0 to 4096,but using my code there is only the maximum and a minimum value around 768 or 1024,instead using your code there is only a maximum value of 255 and a minimum value of 32…
I set bit 5 to zero to avoid activating Vref,it’s true ?
I don’t understand why the values ??aren’t right…help me!!
thanks

Hi, I would like to know if you could figure out what was the problem here, I am going to use the same ADC and I m not sure how to connect it with my arduino UNO.