Coder Social home page Coder Social logo

ads1255's Introduction

ADS1255 / ADS1256 Library

Very Low Noise, 24-Bit Analog-to-Digital Converter

This library is made for the STM32 HAL (Hardware Abstraction Library) platform. The example code is for STM32CubeMX and Keil uVision 5 IDE.

Datasheet: ti.com


forthebadge

Usage

/* USER CODE BEGIN Includes */
#include <ads1255.h>
/* USER CODE BEGIN PV */
ADS125X_t adc1;
/* USER CODE END PV */

int main(void)
{
    /* USER CODE BEGIN 2 */
    adc1.csPort = SPI2_CS_GPIO_Port;
    adc1.csPin  = SPI2_CS_Pin;
    adc1.drdyPort = SPI2_DRDY_GPIO_Port;
    adc1.drdyPin  = SPI2_DRDY_Pin;
    adc1.vref = 2.5f;
    adc1.oscFreq = ADS125X_OSC_FREQ;
    
    printf("\n");
    printf("ADC config...\n");
    // 10 SPS / PGA=1 / buffer off
    ADS125X_Init(&adc1, &hspi2, ADS125X_DRATE_10SPS, ADS125X_PGA1, 0);
    printf("...done\n");
    /* USER CODE END 2 */


    /* Infinite loop */
    /* USER CODE BEGIN WHILE */
    while (1)
    {
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
        float volt[2] = {0.0f, 0.0f};
        ADS125X_ChannelDiff_Set(&adc1, ADS125X_MUXP_AIN0, ADS125X_MUXN_AIN1);
        volt[0] = ADS125X_ADC_ReadVolt(&adc1);
        printf("%.15f\n", volt[0]);
        
        ADS125X_ChannelDiff_Set(&adc1, ADS125X_MUXP_AIN2, ADS125X_MUXN_AIN3);
        ADS125X_CMD_Send(&adc1, ADS125X_CMD_SYNC);
        volt[1] = ADS125X_ADC_ReadVolt(&adc1);
        printf("%.15f\n", volt[1]);
        
    }
    /* USER CODE END 3 */
}

See Also


License

Apache 2.0

(c) 2022 eta Systems GmbH

ads1255's People

Contributors

mnemocron avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.