AnsweredAssumed Answered

problems with AD9956 read timing

Question asked by countingstar on Aug 12, 2010
Latest reply on Aug 14, 2010 by countingstar

I'm  using AD9956 and I need to write and read FTW to the reg of AD9956.When I write control words using 2-wire serial port,it's OK.But if I read the reg of AD9956, the SDI/O port is always '0' which was the input value set by the previous code. It seems that the SDI/O port does not updated by the reg inside. I'm wondering whether my code is proper. Thanks:)

                                                                

 


Part of my codes related are as follows:

write1byte(0x86);
read1byte();
read1byte();
ftw_init[5]=read1byte();
ftw_init[4]=read1byte();
ftw_init[3]=read1byte();
ftw_init[2]=read1byte();
ftw_init[1]=read1byte();
ftw_init[0]=read1byte();

void write1byte(uc byte)
{
uc temp1;
int i;
temp1=0x80;
delay(10);

    for(i=0;i<8;i++)    {
        if((byte&temp1)==0x0)          SDI=0;
       else
           SDI=1;
        SCLK=0;
    delay(10);
        SCLK=1;
    delay(10);
       temp1=temp1>>1;
    }}
uc read1byte(void)
{
uc temp1;
uc tempo;
  
int i;
tempo=0x00;
temp1=0x80;
                           
   for(i=0;i<8;i++)    {
    SCLK=1;
    delay(200);
            SCLK=0;
   delay(200);


        if(SDI==0)          tempo=0;
       else
           tempo+=temp1;
                temp1=temp1>>1;      
    }
return(tempo);

Outcomes