| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #ifndef _ADC_H_
- #define _ADC_H_
- /*********************************************************************************************************
- * 包含头文件
- *********************************************************************************************************/
- #include "Main.h"
- #include "gd32e23x.h"
- #include "SysTick.h"
- #include "ADC.h"
- #include "board_cfg.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 0.66 //实际电流传感器的灵敏度,单位是V/A,扩大成1
- #define A_gain 2 //电压放大倍数
- #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
- /*********************************************************************************************************
- * 内部函数声明
- *********************************************************************************************************/
- void Init_ADC(void);
- void ConfigADCGPIO(void);
- void ADC_dma_config(void);
- void che442e_Init(void);
- void che442_change_ch(uint8_t channel);
- uint32_t DC_I_calfunction(uint16_t da,uint8_t channel);
- void read_adc_val(void);
- uint32_t read_voltage(uint8_t channel);
- #endif
|