This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ADS124S06: Confusion about two reading data mode

Part Number: ADS124S06

Hi all,

Recent I use ADS124S06 to do RTD temperature measurement project. When I read data from ADC with two different mode, I have some questions about them. When I use "Read Data by RDATA Command", in datasheet p69. Following is my code, ADC_num=100 and sample rate is 100 SPS. I only use SCLK, MOSI, MISO three pin to read data from ADC and ignore the state of DRDT pin. I find that I have to send RDATA command before each data read, or the data read will be abnormal.  Am I right about this mode? And I also have following questions:

  • What is update frequency of data-holding register? 
  • what is the difference of output shift register?

If data rate is 100SPS, the update frequency of output shift registeris 100Hz, then what is the frequency of data-holding register?

Following is my code about how to read data from ADC.

for(i=0;i<ADC_num;i++)

{

delay_ms(3);

sendCommand(RDATA_OPCODE_MASK); //First time I did not add this code

delay_ms(3);

ADC_readdata[i]=(uint32_t)0xffffff & dataRead();  //Read data

}

  • Hi Charles,

    It is not clear to me what you are attempting to do with this code.  Let's analyze your code.  You have a collection loop of 100 and the output data rate for the ADS124S06 set to 100sps (new data available every 10ms) if you are using continuous conversion mode.  Your delay is 6ms (3ms+3ms). So it is not possible to collect new data in each loop iteration.  If you are not in continuous conversion mode, then you need to send the START command for each iteration.

    If you look at the dataRead function, you will notice that all this function does is to send a series of SCLKs to capture the data and does not contain the RDATA command.  If desire you could place the RDATA command inside of the dataRead function.

    When issuing just the dataRead function, you need to make sure you wait until the conversion is complete before attempting to read the result as the shift register is actually in a ring buffer and will repeat if you keep sending SCLKs. There is a tiny possibility that data could be corrupted if the conversion update occurs while you are reading the results.  Using the RDATA command prevents data corruption by moving the last conversion data to the output buffer and will not be affected by a new conversion update.  The data will stay in the buffer until read, or if CS goes high, or if a timeout occurs for SPI communication for the ADS124S06. 

    There is yet another problem.  The output of the ADS124S06 is binary 2's complement (a signed value) and the dataRead function returns a signed 32-bit value.  For some reason you are using an AND to create an unsigned value using only 24 bits.  If you are trying to convert the value to unipolar format this manipulation is incorrect.  There is no good reason to change the data format from a signed value to an unsigned value as the dynamic range remains the same.

    Best regards,

    Bob B

  • Hi Bob,

    Thanks to your quick response. I am sorry to not explain my question clearly. I am using continuous conversion mode, and I find that I have to add RDATA command before each data read. At first I thought that in continuous conversion mode and only need to send RDATA command one time and the  RDATA command is sent before collection loop of 100 datas. But the data will be abnormal sometimes. So I add RDATA command each data read. I am confused about this operation. Is it right? You said "The data will stay in the buffer until read, or if CS goes high, or if a timeout occurs for SPI communication for the ADS124S06. ", it means that if the data in data-holding register is read, it will update right now? Or how the data in data-holding register change and what is its frequency to change?

    Below  is data read code. In the xferWord() function, I only send ox00 to ADC and capture the data from ADC.

    uint32_t dataRead(void)

    {

    uint32_t iData=0;

    // get the conversion data

    iData = xferWord();

    iData = (iData<<8) + xferWord();

    iData = (iData<<8) + xferWord();

    return iData ;

    }

  • Hi Charles,

    There are two different methods as to data collection.  One is shown in Figure 90 and the other is shown in Figure 91.  The way you have the dataRead() function is similar to Figure 90.  Using this method is similar to having a ring or circular buffer as the data will repeat.  If you use the method in Figure 91, then you need to send the RDATA command first and then read the data.  RDATA will need to be sent each time you wish to read the data if you use this method of data collection.

    How will you know that the conversion is complete and new data is available?  You know by monitoring DRDY.  If you have the data rate set to 100sps, then every 10ms you will see DRDY pulse or at least transition from a high to low.

    I would suggest that you monitor your communication with a scope, and also monitor DRDY to see the response.  This should answer a lot of your questions.  You should only be attempting to read the ADC conversion results between DRDY cycles.  You cannot just continually attempt to read from the device and expect good results each time.

    Also remember that the data is binary 2's complement from the ADS124S06.  You are attempting to save the data as unsigned and this will not work as you will misinterpret the data.  For example, 0x000001 is +1 code above 0. 0xFFFFFF is -1 code from 0.  You should be using a signed integer and properly sign extended the 24-bit value to 32-bits.

    Best regards,

    Bob B

  • Hi Bob,

    Thank you very much. If I am using the method in Figure 91 to read data. RDATA will need to be sent each time, it means that the data holding register will be update by this command, am I right? I am just curious about the update frequency of data-holding register. For I did not use DRDY pin(pin13), now I used pin12(DOUT/DRDY) to know that the conversion is complete and new data is available, but I need to send a RREG command to read a register where the least significant bit is 1 (seen p 70). For most customer will not use DRDY pin, I am thinking this may not convenient for customer. How do you think of this function?
  • Hi Charles,

    When the RDATA command is issued, the last conversion result is placed into the output register. So yes, you are correct.

    You are not required to use the DRDY pin.  You can use a timer method, or use the function of the DOUT/DRDY as that pin will also follow DRDY.  The usage is shown in Figure 86.  We have found that most customers will use either DRDY or DOUT/DRDY.

    It is important to set the DOUT/DRDY pin high as it will be difficult to poll for the high to low transition otherwise.  Using the ADS124S06 you should be able to read the ID register where the device ID for the ADS124S06 is '1' for the LSB.

    Best regards,

    Bob B

  • Hi Bob,

    Thanks a lot!