Hello Everyone,
I make some changes in hardware design:-
1) POL pin tie to Ground instaed of connecting to GPIO pin of microcontroller.
2) RESET pin is connected to +3.3VDC instead of connecting to GPIO pin of microcontroller.
3) Unused pins (AIN2(+)/D1,AIN2(-)/D1,ACX,ACX')are connecting to AGND.
-Reset the adc by writing 32 times 1's in ADC
Code C - [expand] |
1
2
| WriteRegister(CR_SINGLE_WRITE,4,0xFFFFFFFF);
__delay_cycles (200); |
-I can successfully read default value of register after reset the adc.
-I just did internal full scale calibration on 80mV, then internal calibration on 0 to 20mV range and write gain and offset register in AD7730( The Gain and offset registers are read it during calibration mode,
-I followed exact calibration procedure for 0 to 20 mV range as per given in datasheet but outut is unstable.it keeps jumping up and down(for ex for 0.02 mV I got 0.04 to 0.08 mV ).
-I just want stable and correct output. I am attaching screenshot of readings which I have taken and code for your reference.
Code C - [expand] |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
| /* this setup is for data out rate of ADC is 50 Hz for calibration only,Chop mode filter enable, skip off and fast off
* Internal full scale calibration for unipolar input,24 bit data mode,5V reference,channel 1
* Internal zero scale calibration for unipolar input,24 bit data mode,5V reference,channel 1
*/
/*internal calibration*/
WriteRegister(CR_SINGLE_WRITE|CR_FILTER_REGISTER,3,FR2_SINC_AVERAGING_2048|FR1_SKIP_OFF|FR1_FAST_OFF|FR0_CHOP_ON);
__delay_cycles (1000);
WriteRegister(CR_SINGLE_WRITE|CR_DAC_REGISTER,1,DACR_OFFSET_SIGN_NEGATIVE|DACR_OFFSET_NONE);
__delay_cycles (200);
WriteRegister(CR_SINGLE_WRITE|CR_MODE_REGISTER,2,MR1_MODE_INTERNAL_FULL_CALIBRATION| MR1_BU_UNIPOLAR|MR1_WL_24_BIT|MR0_HIREF_5V|MR0_RANGE_80MV|MR0_CHANNEL_1);
while(!((P2IN&BIT0)==0)){} //wait for calibration complete
__delay_cycles (200);
WriteRegister(CR_SINGLE_WRITE|CR_MODE_REGISTER,2,MR1_MODE_INTERNAL_ZERO_CALIBRATION|MR1_BU_UNIPOLAR|MR1_WL_24_BIT|MR0_HIREF_5V|MR0_RANGE_20MV|MR0_CHANNEL_1);
while(!((P2IN&BIT0)==0)){} //wait for calibration complete
__delay_cycles (200);
// write offset register
WriteRegister(CR_SINGLE_WRITE|CR_OFFSET_REGISTER,3,0x800010);
__delay_cycles (200);
// write gain registers
WriteRegister(CR_SINGLE_WRITE|CR_GAIN_REGISTER,3,0x65DD20);//592035 65DD20
__delay_cycles (200);
WriteRegister(CR_SINGLE_WRITE|CR_FILTER_REGISTER,3,FR2_SINC_AVERAGING_100|FR1_SKIP_OFF|FR1_FAST_OFF|FR0_CHOP_ON);
__delay_cycles (1000);
WriteRegister(CR_SINGLE_WRITE|CR_MODE_REGISTER,2,MR1_MODE_CONTINUOUS|MR1_BU_BIPOLAR|MR1_WL_24_BIT|MR0_HIREF_5V|MR0_RANGE_20MV|MR0_CHANNEL_1);
while(!((P2IN&BIT0)==0)){} //wait for device ready for conversion spi_tx(CR_CONTINUOUS_READ_START|CR_DATA_REGISTER); //read continuous data mode |
Does anyone have idea about what to do to get stable readings. Is there any mistake to write in filter register(filters which I have set are correct??)