Hi there!
I had ordered a sample of ADS7813 and tried to get work with an Arduino board. And my problem is i cant get out a better resolution than two decimal place. The first 10 bit seems ok, from MSB, but the last 6 bit is bouncing pell-mell. Here are some conversion results:
3.2569353 | 10100110101110 |
3.2569353 | 10100110110101 |
3.2584612 | 10100110110110 |
3.2599871 | 10100110111001 |
3.2609026 | 10100110110101 |
3.2609026 | 10100110111000 |
3.2609026 | 10100110110001 |
3.2657856 | 10100110110100 |
3.2599871 | 10100110110100 |
3.2566301 | 10100110110001 |
3.2526626 | 10100110110100 |
3.2566301 | 10100110110101 |
3.2593767 | 10100110101100 |
3.2609026 | 10100110110110 |
The first column values is in voltage the second columns values is the conversion result.
I bulid the circuit in a bread-board i used the same capacitors as in the datasheet i tried another input values and i got the same results.
here is my code in Arduino (same as C):
digitalWrite(CLOCK,LOW);
digitalWrite(CONV,LOW);
delayMicroseconds(1);
digitalWrite(CONV,HIGH);
while(busy==0){ // while BUSY is high still wait
busy=digitalRead(BUSY);
}
for(int i=0;i<16;i++){ //here start the read of the 16 bit
digitalWrite(CLOCK,HIGH);
x[i]=digitalRead(DATA);
delayMicroseconds(20);
digitalWrite(CLOCK,LOW);
}
for(int j=1, c=16384j<16;j++,c=c/2){ //this is how i piece together the 16 bit data in decimal, 15bit because the firs is the sign bit
val+=x[j]*c;
}
val=5*val*(double)1/32767; //this is how i convert the number to voltage with +-5V input range