ADS131A04 Example C Code  1.0.0
ADS131A04 Example C Code

Table of Contents

ads131a04.jpg

The ADS131A04 precision delta-sigma (ΔΣ) analog-to-digital converter (ADC) communicates using a serial peripheral interface (SPI) to allow for device configuration, control, and data retrieval. To interface the ADC with a microcontroller (MCU), the firmware or software engineer needs to know how to correctly configure their MCU's serial peripheral, sequence serial commands, and control the SPI timing of command bytes to the ADC. To assist in this process, this example code is intended to show how to initialize communication with the ADS131A04 at a high-level.


IMPORTANT: This code demonstrates how to use the ADS131A04 in Asynchronous Slave Mode (the recommended mode of operation for most applications), other SPI modes are not supported in this example. Examples of hamming validation are also not provided; however, examples of how to use CRC validation are included.


Modules

  1. ADS131A04

    Files: ads131a04.h, ads131a04.c
    Description: Contains header and source files with register map definitions and high-level functions for interfacing with the ADS131A04.


  2. Hardware Abstraction Layer (HAL)

    Files: hal.h, hal.c
    Description: The HAL provides processor specific functions called by the ADS131A04 module.

    IMPORTANT: This module will need to be modified to work with your hardware!


How to use this code

Reference the ads131a04.c file while writing your own code for examples of how to perform typical ADC operations, such as register read/writes and reading data...

OR

Copy and paste the example code into your project, and update the files as needed to get access to the provided APIs...

  1. Copy the ADS131A04 and HAL module files into your firmware project.
  2. Add library references in hal.h to your processor-specific library file(s).
  3. Edit ALL of the function implementations inside of hal.c to provide the specified functionality with your processor and processor-specific library APIs.
  4. Include a reference to hal.h somewhere in your program and call the InitADC() function to initialize the MCU peripherals connected to the ADS131A04.
  5. Include a reference to ads131a04.h in your application (from main.c or wherever ADC communication is handled). You should now be able to begin calling the ADS131A04 module functions in your code.


IMPORTANT: This code was tested on an MSP432E401Y 32-bit ARM® Cortex®-M4F based MCU using TI Code Composer Studio's 18.12.4.LTS ARM compiler. Example code is provided to aid in the creation of your own software implementation and should not be considered as fully verified and end-equipment ready. Example code is written for readability and is not optimized for performance.


Support

For questions or issues, visit the TI E2E Forums.

e2e.jpg


Release History

v1.0.0 - Initial release (3-20-2020)


License

BSD-3-Clause
Refer to the ADS131A04 Example C Code_1.0.0_manifest.html file for license text...