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.

ADS1220: i want the ads1220 spi mode code

Part Number: ADS1220

Hi, 

i want to  interfacing the ATSAMD21G18A mcu and ADS1220.

i was activated the spi  of ATSAMD21G18A. but i need a code for adc(using ADS1220). please can any one send the code , why because i read the datasheet of the ADS1220 in tha i got one Pseudo Code, based on this i am making the code in that i couldn't understand the bellow highlighted please any one help me to solve this problem

Power-up;
Delay to allow power supplies to settle and power-up reset to complete (minimum of 50 μs);
Configure the SPI interface of the microcontroller to SPI mode 1 (CPOL = 0, CPHA = 1);
If the CS pin is not tied low permanently, configure the microcontroller GPIO connected to CS as an
output;
Configure the microcontroller GPIO connected to the DRDY pin as a falling edge triggered interrupt
input;
Set CS to the device low;
Delay for a minimum of td(CSSC);
Send the RESET command (06h) to make sure the device is properly reset after power-up;
Delay for a minimum of 50 μs + 32 · t(CLK);
Write the respective register configuration with the WREG command (43h, 08h, 04h, 10h, and 00h);
As an optional sanity check, read back all configuration registers with the RREG command (23h);
Send the START/SYNC command (08h) to start converting in continuous conversion mode;
Delay for a minimum of td(SCCS);
Clear CS to high (resets the serial interface);
Loop
{
Wait for DRDY to transition low;
Take CS low;
Delay for a minimum of td(CSSC);
Send 24 SCLK rising edges to read out conversion data on DOUT/DRDY;
Delay for a minimum of td(SCCS);
Clear CS to high;
}
Take CS low;
Delay for a minimum of td(CSSC);
Send the POWERDOWN command (02h) to stop conversions and put the device in power-down mode;
Delay for a minimum of td(SCCS);
Clear CS to high;

  • Hi Venkatesh,

    Welcome to the forum!  One reason the startup process is shown as pseudo code is due to many processor variations available.  Some processors will have an SPI peripheral while others will require a bit-bang approach using GPIOs.  We do have some generic function code for an MSP430 processor found here:

    http://www.ti.com/lit/zip/sbac227

    The WREG command is explained on page 36 of the ADS1220 datasheet in section 8.3.5.6.  In the pseudo code example the highlighted command is 0x43 which is decoded as the WREG command starting at register 0 and writing 4 registers.  The remaining data is what is written to the registers.

    For reading the conversion results, the RDATA can be issued, or the results can be read directly by issuing 24 SCLKs after DRDY transitions from high to low.  For most SPI peripherals this would require writing (or assigning) a value to the SPI transmit buffer.  The data returned would be in the receive buffer after transmit data has been sent.  A dummy byte you can write to the transmit buffer is 0xFF. 

    Best regards,

    Bob B