mppt/Hardware/inc/adc.h

49 lines
1.6 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef __ADC_H
#define __ADC_H
#include "ch32l103.h"
#include "ring_queue2.h"
//typedef struct _ADC_DATA {
// uint16_t total_CHG_CURR; /* 一个控制周期中adc采集的值之和 充电电流 */
// uint16_t num_CHG_CURR; /* 一个控制周期中adc采集次数之和 */
// uint16_t total_PV_VOLT_OUT; /* 输出电压 */
// uint16_t num_PV_VOLT_OUT;
// uint16_t total_DSG_CURR; /* 放电电流 */
// uint16_t num_DSG_CURR;
// uint16_t total_PV1_VOLT_IN; /* 系统输入电压 */
// uint16_t num_PV1_VOLT_IN;
// uint16_t total_PV_VOLT_IN1; /* 太阳能板输出电压 */
// uint16_t num_PV_VOLT_IN1;
// uint16_t total_MOSFET_Temper; /* mos管温度 */
// uint16_t num_MOSFET_Temper;
//}ADC_DATA;
//#define data_len 50
//typedef struct _ADC_DATA {
// uint16_t num; /* 一个控制周期中adc采集次数 */
// uint16_t CHG_CURR_array[data_len]; /* 充电电流 */
// uint16_t PV_VOLT_OUT_array[data_len]; /* 输出电压 */
// uint16_t DSG_CURR_array[data_len]; /* 放电电流 */
// uint16_t PV_VOLT_IN_array[data_len]; /* 太阳能板输出电压 */
// uint16_t SYS_VOLT_IN_array[data_len]; /* 系统输入电压 */
// uint16_t MOSFET_Temper_array[data_len]; /* mos管温度 */
//}ADC_DATA;
#define adcBuffSize 100
typedef struct _ADC_DATA {
RingQueue2 RQCHG_CURR;
uint32_t total_CHG_CURR; /* 充电电流一段时间中adc值的和 */
RingQueue2 RQDSG_CURR;
uint32_t total_DSG_CURR; /* 放电电流一段时间中adc值的和 */
}ADC_DATA;
extern ADC_DATA g_adcData;
extern int16_t Calibrattion_Val;
void ADC_all_Init(void);
void ADC_TIM_DMA_Init(void);
#endif