| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- /*********************************************************************************************************
- * 模块名称:ADC.h
- * 摘 要:内部ADC应用,采用12bit。
- * 当前版本:1.0.0
- * 作 者:anycrying
- * 完成日期:2024年04月06日
- * 内 容:
- * 注 意:
- **********************************************************************************************************
- * 取代版本:
- * 作 者:
- * 完成日期:
- * 修改内容:
- * 修改文件:
- *********************************************************************************************************/
- #ifndef _ADC_H_
- #define _ADC_H_
- /*********************************************************************************************************
- * 包含头文件
- *********************************************************************************************************/
- #include "Main.h"
- #include "gd32e230x_conf.h"
- #include "SysTick.h"
- #include "ADC.h"
- #include "board_cnf.h"
- /*********************************************************************************************************
- * 宏定义
- *********************************************************************************************************/
- #define ADC_Vref 33 //实际ADC参考电压3.3V,扩大成33
- #define ADC_V_Gain 4020 //实际 200.9 扩大2009
- #define ADC_Fulscale 4096 //ADC满量程值,12位,即4096
- #define I_sens 1 //实际电流传感器的灵敏度,单位是V/A,扩大成1
- #if SUPPORT_STM32_ADC
- #define A_gain 1 //电压放大倍数
- #else
- #define A_gain 3 //电压放大倍数
- #endif
- #define ADC_CH_N 8 //通道数
- #define ADC_Avg_N 12 //平均次数
- #define ADC_0_5_RCU RCU_GPIOA
- #define ADC_67_RCU RCU_GPIOB
- #define ADC_0_5_IO GPIOA
- #define ADC_67_IO GPIOB
- #define ADC_ch0 GPIO_PIN_0
- #define ADC_ch1 GPIO_PIN_1
- #define ADC_ch2 GPIO_PIN_4
- #define ADC_ch3 GPIO_PIN_5
- #define ADC_ch4 GPIO_PIN_6
- #define ADC_ch5 GPIO_PIN_7
- #define ADC_ch6 GPIO_PIN_0
- #define ADC_ch7 GPIO_PIN_1
- #if SUPPORT_2_V_GA_CHN
- #define ADC_Vol_ch1 GPIO_PIN_2
- #define ADC_Vol_ch2 GPIO_PIN_3
- #endif
- /*********************************************************************************************************
- * 内部函数声明
- *********************************************************************************************************/
- void Init_ADC(void);
- void ConfigADCGPIO(void);
- void ADC_dma_config(void);
- uint32_t DC_I_calfunction(uint16_t da);
- #if SUPPORT_2_V_GA_CHN
- uint32_t DC_V_calfunction(uint16_t va);
- #endif
- void read_adc_val(void);
- #endif
|