ADC.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*********************************************************************************************************
  2. * 模块名称:ADC.h
  3. * 摘 要:内部ADC应用,采用12bit。
  4. * 当前版本:1.0.0
  5. * 作 者:anycrying
  6. * 完成日期:2024年04月06日
  7. * 内 容:
  8. * 注 意:
  9. **********************************************************************************************************
  10. * 取代版本:
  11. * 作 者:
  12. * 完成日期:
  13. * 修改内容:
  14. * 修改文件:
  15. *********************************************************************************************************/
  16. #ifndef _ADC_H_
  17. #define _ADC_H_
  18. /*********************************************************************************************************
  19. * 包含头文件
  20. *********************************************************************************************************/
  21. #include "Main.h"
  22. #include "gd32e230x_conf.h"
  23. #include "SysTick.h"
  24. #include "ADC.h"
  25. /*********************************************************************************************************
  26. * 宏定义
  27. *********************************************************************************************************/
  28. #define ADC_Vref 33 //实际ADC参考电压3.3V,扩大成33
  29. #define ADC_Fulscale 4096 //ADC满量程值,12位,即4096
  30. #define I_sens 1 //实际电流传感器的灵敏度,单位是V/A,扩大成1
  31. #define A_gain 3 //电压放大倍数
  32. #define ADC_CH_N 8 //通道数
  33. #define ADC_Avg_N 4 //平均次数
  34. #define ADC_0_5_RCU RCU_GPIOA
  35. #define ADC_67_RCU RCU_GPIOB
  36. #define ADC_0_5_IO GPIOA
  37. #define ADC_67_IO GPIOB
  38. #define ADC_ch0 GPIO_PIN_0
  39. #define ADC_ch1 GPIO_PIN_1
  40. #define ADC_ch2 GPIO_PIN_4
  41. #define ADC_ch3 GPIO_PIN_5
  42. #define ADC_ch4 GPIO_PIN_6
  43. #define ADC_ch5 GPIO_PIN_7
  44. #define ADC_ch6 GPIO_PIN_0
  45. #define ADC_ch7 GPIO_PIN_1
  46. /*********************************************************************************************************
  47. * 内部函数声明
  48. *********************************************************************************************************/
  49. void Init_ADC(void);
  50. void ConfigADCGPIO(void);
  51. void ADC_dma_config(void);
  52. uint32_t DC_I_calfunction(uint16_t da);
  53. void read_adc_val(void);
  54. #endif