Skip to content

C library for ADS1255/ADS1256 ultra low noise 24-bit ADC for STM32 platform

License

Notifications You must be signed in to change notification settings

eta-systems/ADS1255

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

C library for ADS1255/ADS1256 ultra low noise 24-bit ADC for STM32 platform

Topics

Resources

License

Stars

Watchers

Forks

Languages