AnsweredAssumed Answered

AD 7734 data communication and calibration problem

Question asked by ahmet on Dec 6, 2011
Latest reply on Dec 12, 2011 by Cman

I use AD7734 and PIC 18F series microcontroller.

 

 

I use this code, we can all register write and read.

 

This code is written CCS C complier code

 

void ad7734_write_reg(int data,int secim)
{
int i=0;
int8 temp=0x80;

output_high(cs1);
output_high(cs2);
output_low(dout);
output_low(din);
output_high(clk);
if(secim==1)
output_low(cs1);
if(secim==2)
output_low(cs2);
for(i=0;i<8;i++)
{
output_low(clk);
delay_us(100);
if((data&temp)==0)
output_low(dout);
else
output_high(dout);
temp=temp>>1;
output_high(clk);
delay_us(100);
}
output_high(cs1);
output_high(cs2);
}


int8 ad7734_read_reg(int secim)
{
int i=0;
int data=0;
output_high(cs1);
output_high(cs2);
output_low(dout);
if(secim==1)
output_low(cs1);
if(secim==2)
output_low(cs2);
for(i=0;i<8;i++)
{
output_low(clk);
delay_us(100);
if(input(din)==0)
data=data<<1;
else
{
data=data<<1;
data=data+0x01;
}
output_high(clk);
delay_us(100);
}
output_high(cs1);
output_high(cs2);
return data;
}


void read_ad7734(int readtime,int secim)
{
unsigned char data;
int i,j;
data=0x00;
for(i=0;i<readtime;i++)
{
while(input(rd1)==1);

ad7734_write_reg(0x48,secim);
output_low(dout);
for(j=0;j<24;j++)
{
output_low(clk);
delay_us(100);
if(input(din)==0)
data=data<<1;
else
{
data=data<<1;
data=data+0x10;
}
output_high(clk);
delay_us(100);
if(j==7||j==15||j==23)
{
printf("%X",data);
data=0x00;
}
}
printf("\r\n");
output_high(cs1);
output_high(cs2);
}
printf("\n\n\n");
}

 

 

I make a calibration after, I read channel data register inside data, for rs232 to computer.

Then this data copy and paste this web site;  http://designtools.analog.com/dt/ad773248/ad773248.html


This result and my input (battery) voltage is very different. And every measurument is different.

My calibration prosedur;

ADC Zero-Scale Calibration

ADC Full-Scale

Channel Zero-Scale Cal

Channel Full-Scale Cal.

This sequence is correct?

If this sequence of operation is not correct, pls say me correct sequence.

And calibration instantly input voltage be open circuit, short circuit or another connect. Which?

If are you have a samples code and circuits send me pls.

 

my pcb and schema in the attach.

Outcomes