AnsweredAssumed Answered

Problem with connecting AD7705

Question asked by meerkat on Apr 9, 2015
Latest reply on Apr 15, 2015 by jcolao

Hello

 

I'm working on ad7705

 

Crysatal 4.9152 M

VCC = 5 volt

vref =2.5 volt

 

i can't read from ad7705

 

i call these two function for inial ADC:

AD7705_Reset();

AD7705_init();

 

void AD7705_Reset(void){

  AD7705_RST_ACTV;

  AD7705_CS_HIGH;

   __delay_cycles(40);

   AD7705_RST_DECTV;

   __delay_cycles(400);

   AD7705_WR(0xff);

   AD7705_WR(0xff);

   AD7705_WR(0xff);

   AD7705_WR(0xff);

    __delay_cycles(400);

}

void AD7705_WR(unsigned char data){

  AD7705_CS_LOW;

  SPDR = data;

  while(!(SPSR & (1<<SPIF)));

  AD7705_CS_HIGH;     

}

void AD7705_init(void){

 

   AD7705_WR(0x20);

   AD7705_WR(0x0C);

   AD7705_WR(0x10);

   AD7705_WR(0x40);

    while (AD7705_DRDY);

}

unsigned int AD7705_RD(void){

unsigned int data;

while (AD7705_DRDY);

AD7705_WR(0x38);         

while (AD7705_DRDY);

  AD7705_CS_LOW

   SPDR = 0x00;                  

    while(!(SPSR & (1<<SPIF)));             

  data = SPDR;                  

  data <<= 8;

         SPDR = 0x00;                  

    while(!(SPSR & (1<<SPIF)));                   

        data |= SPDR;                

AD7705_CS_HIGH

return (data);//

}

 

after sending these two command  i see on scope a continues pulse with 20ms interval .

according to data sheet and commands this behave shows adc get commands and every things is OK.

here is logic analyzer screen shot :

Capture.PNG

 

but when i try to read nothing is returned .:

here is my reading code :

 

unsigned int AD7705_RD(void){

  unsigned int data;

while (AD7705_DRDY);

AD7705_WR(0x38);         

while (AD7705_DRDY);

  AD7705_CS_LOW

   SPDR = 0x00;                  

    while(!(SPSR & (1<<SPIF)));             

  data = SPDR;                  

  data <<= 8;

          SPDR = 0x00;                  

    while(!(SPSR & (1<<SPIF)));                 

          data |= SPDR;                    

AD7705_CS_HIGH

return (data);//

}

2.PNG

 

 

could you pleas help me and tel me what is my mistake ?

 

best regards

Outcomes