Dear There,
I am using ads124s08 one channel in single-shot mode, and control it with a host PC running LabVIEW Code via COM.
If I Start the LabVIEW Code, ads124s08 with running the following SECTION I and SECTION 2 code:
SECTION 1: (In Main function)
Set CS to the device low;
Delay for td(CSSC);
Send the RESET command (06h) to make sure the device is properly reset after power-up;
Delay for 4096 · tCLK;
Write the respective register configuration with the WREG command; (set Singe-shot; PGA; Sample Rate; Select One channel AI6+AI7)
Delay for td(SCCS);
Clear CS to high;
Set START/SYNC low;
Delay for a minimum of 24 · tCLK;
Set START/SYNC high; //First start ADC single-shot Conversion
Delay for a minimum of 28 · tCLK;
Set START/SYNC low; //ADC Conversion Complete, stop it for next conversion
SECTION 2: (In Interrupt Function)
Loop
{
Wait for DRDY to transition low; (Interrupt)
Take CS low;
Delay for td(CSSC);
Send the RDATA command;
Send 24 SCLK rising edges to read out conversion data on DOUT/DRDY;
Delay for td(SCCS);
Clear CS to high;
Set START/SYNC high; //start ADC single-shot Conversion again
Delay for a minimum of 28 · tCLK;
Set START/SYNC low; //ADC Conversion Complete, stop it for next conversion
//Waiting for /DRDY interrupt
}
In this way, ads124s08 will acquire "continuously" in single-shot mode. Then I stop LabVIEW code, which will stop the loop in SECTION 2. Things goes very well up to now.
The issue is, if I restart the LabVIEW Code again, sometimes (perhaps 20% possibility) I can see the fist sample was obviously wrong(and the remaining samples are good). With further research, I found the wrong first sample was EXACTLY the last sample of previous acquisition , like the following graph.
Personally I think the problem may come from the internal data-holding register, since I was reading ads124s08 by RDATA Command. It looks like if I stop the loop in SECTION2, and restart SECTION 1, the last sample may be retain in data-holding register, and host LabVIEW will read it again in next acquisition.
My question is ,
1) Is there a way I can clear the data in data-holding register completely, so that I will never read in future acquisition?
2) In SECTION I, I DO send a reset COMMAND with 4096*tclk delay, trying to reset ads124s08. But result is not good, since I still can find the wrong first sample.
3) And further, from datasheet page 66, "The RESET command resets the digital filter and sets all configuration register values to default settings" . RESET has no effect on the data register?
4) Of course, if I power off the device hardware and power on again, everything goes well. I never seen the wrong first sample. But I cannot do that in my real work.
Could you help me with some suggestions about the RDATA Command? Thanks.