项目作者: KiritoGoLeon

项目描述 :
ads1115 drive for stm32f103
高级语言: C
项目地址: git://github.com/KiritoGoLeon/stm32_16bit_adc_driver.git
创建时间: 2018-02-02T17:27:44Z
项目社区:https://github.com/KiritoGoLeon/stm32_16bit_adc_driver

开源协议:

下载


ADS1115

ADS1115 is a 16bits Analog to Digital Converter

The ADS1115 is a 4-Channel Analog to Digital Converter

this lib is ADS1115 drive for stm32f103

how to use it ?

you only to add the bsp_ads1115.c and bsp_ads1115.h to keil5 Project

then Init in the main function, and use GetAds1115Values function to get adc values,

for eg, use printf to show data in Serial port . and you can see there is anything else! 0.125???

  1. int main()
  2. {
  3. printf_init();
  4. ads1115_Init();
  5. while (1)
  6. {
  7. printf("%f\r\n",GetAds1115Values()*0.125);
  8. }
  9. }

why adc values Multiply 0.125?

the ads1115 has vref insdide chip ,so we don’t like others Converter use “ 3.3/4096”

the values from GetAds1115Values function is inside values ,if it Multiply gain_coefficient t,then the realValues is coming !

you can change it in bsp_ads1115.c

this list is GAIN with GAIN_COEFFICIENT

  1. typedef enum
  2. {
  3. GAIN_TWOTHIRDS = ADS1015_REG_CONFIG_PGA_6_144V, // 0.1875mV
  4. GAIN_ONE = ADS1015_REG_CONFIG_PGA_4_096V, // 0.125mV
  5. GAIN_TWO = ADS1015_REG_CONFIG_PGA_2_048V, // 0.0625mV
  6. GAIN_FOUR = ADS1015_REG_CONFIG_PGA_1_024V, // 0.03125mV
  7. GAIN_EIGHT = ADS1015_REG_CONFIG_PGA_0_512V, // 0.015625mV
  8. GAIN_SIXTEEN = ADS1015_REG_CONFIG_PGA_0_256V // 0.0078125mV
  9. } adsGain_t;