Compare commits

...

2 Commits

Author SHA1 Message Date
起床就犯困 ea6d12ca11 adc+tim+dma采集有问题 2024-10-14 10:39:02 +08:00
起床就犯困 c5ed140daf 确定电流波动原因为理想二极管和防反mos 2024-10-10 15:36:10 +08:00
43 changed files with 10613 additions and 9908 deletions

View File

@ -69,8 +69,9 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Peripheral/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/mppt_Nos_V0.4/App/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/mppt_Nos_V0.4/Hardware/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/mppt_Nos_V0.4/Drivers/RingQueue}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/mppt_Nos_V0.4/Drivers/TimeSliceOffset}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/mppt_Nos_V0.4/Drivers/RingQueue}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/mppt_Nos_V0.4/Drivers/RingQueue2}&quot;"/>
</option>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std.2020844713" name="Language standard" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std" useByScannerDiscovery="true" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std.gnu99" valueType="enumerated"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.defs.177116515" name="Defined symbols (-D)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols"/>
@ -123,9 +124,10 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="Startup|Peripheral|Ld|Debug|Core" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry excluding="Drivers|Startup|Peripheral|Ld|Debug|Core" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Core"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Debug"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="Drivers"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Ld"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Peripheral"/>
<entry excluding="startup_ch32v20x_D8.S|startup_ch32v20x_D8W.S" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Startup"/>
@ -150,4 +152,5 @@
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
<storageModule moduleId="refreshScope"/>
</cproject>

View File

@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="998107432084761222" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1033085767641952736" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>

View File

@ -14,9 +14,9 @@
float get_CHG_CURR(void);
float get_PV_VOLT_OUT(void);
float get_DSG_CURR(void);
float get_PV1_VOLT_IN(void);
float get_PV_VOLT_IN1(void);
float get_PV_VOLT_IN(void);
float get_SYS_VOLT_IN(void);
float get_MOSFET_Temper(void);
float get_PV2_VOLT_IN(void);
//float get_PV2_VOLT_IN(void);
#endif /* APP_INC_COLLECT_CONVERSION_H_ */

View File

@ -15,13 +15,20 @@
#include "uart_dev.h"
#include <string.h>
#define ONLYPOWER 1
//#define ONLYPOWER 1
//#define CHG_CURR ADC_Channel_1
//#define PV_VOLT_OUT ADC_Channel_2
//#define DSG_CURR ADC_Channel_3
//#define PV1_VOLT_IN ADC_Channel_4
//#define PV_VOLT_IN1 ADC_Channel_5
//#define MOSFET_Temper ADC_Channel_6
//#define PV2_VOLT_IN ADC_Channel_7
#define CHG_CURR ADC_Channel_1
#define PV_VOLT_OUT ADC_Channel_2
#define DSG_CURR ADC_Channel_3
#define PV1_VOLT_IN ADC_Channel_4
#define PV_VOLT_IN1 ADC_Channel_5
#define PV_VOLT_IN ADC_Channel_4
#define SYS_VOLT_IN ADC_Channel_5
#define MOSFET_Temper ADC_Channel_6
#define PV2_VOLT_IN ADC_Channel_7
@ -32,8 +39,8 @@
const float P_CHG_CURR = ((1.0 / (50 * 0.005 / 2)) / 4095 * 2.5);
/* 光伏充电输出电压比例,分压系数(放电时采集不准) */
//const float P_PV_VOLT_OUT = (47.0 + 10.0) / 10.0;
const float P_PV_VOLT_OUT = ((47.0 + 4.7) / 4.7 / 4095 * 2.5);
//const float P_PV_VOLT_OUT = ((56.0 + 10.0) / 10.0 / 4095 * 2.5);
//const float P_PV_VOLT_OUT = ((47.0 + 4.7) / 4.7 / 4095 * 2.5);
const float P_PV_VOLT_OUT = ((56.0 + 10.0) / 10.0 / 4095 * 2.5);
/* 放电电流采集电流倍数 */
const float P_DSG_CURR = ((1.0 / (50 * 0.005 / 2)) / 4095 * 2.5);
///* 光伏1开路输出电压比例 */
@ -133,6 +140,8 @@ const uint16_t mosTemperADC[mosTemperADCLen] = {
static uint16_t get_adc(uint8_t ADC_Channel);
static uint16_t get_aftercalculationAdc(uint8_t ADC_Channel);
static uint16_t middleAverageFilter(uint8_t ADC_Channel);
static uint16_t get_adcDmaTim_middleAverageFilter(uint8_t ADC_Channel);
static uint16_t Get_ConversionVal(int16_t val);
/**
* @brief adc的值
@ -140,10 +149,92 @@ static uint16_t middleAverageFilter(uint8_t ADC_Channel);
* @retval None
*/
uint16_t get_aftercalculationAdc(uint8_t ADC_Channel)
{
return get_adcDmaTim_middleAverageFilter(ADC_Channel);
}
/**
* @brief adc的值
* @param ADC_Channel ADC通道
* @retval None
*/
uint16_t get_aftercalculationAdc1(uint8_t ADC_Channel)
{
return middleAverageFilter(ADC_Channel);
}
/**
* @brief
* @param ADC_Channel ADC通道
* @retval None
*/
uint16_t get_adcDmaTim_middleAverageFilter(uint8_t ADC_Channel)
{
if (ADC_Channel == CHG_CURR) {
return Get_ConversionVal(g_adcData.total_CHG_CURR / adcBuffSize);
}
if (ADC_Channel == DSG_CURR) {
return Get_ConversionVal(g_adcData.total_DSG_CURR / adcBuffSize);
}
return 0;
// uint16_t i,j,k;
// uint16_t temp,sum = 0;
// uint16_t value_buf[g_adcData.num];
//
// if (ADC_Channel == CHG_CURR) {
// for(i = 0; i < g_adcData.num; ++i) {
// value_buf[i] = g_adcData.CHG_CURR_array[i];
// }
//// } else if (ADC_Channel == PV_VOLT_OUT) {
//// for(i = 0; i < g_adcData.num; ++i) {
//// value_buf[i] = g_adcData.PV_VOLT_OUT_array[i];
//// }
// } else if (ADC_Channel == DSG_CURR) {
// for(i = 0; i < g_adcData.num; ++i) {
// value_buf[i] = g_adcData.DSG_CURR_array[i];
// }
//// } else if (ADC_Channel == PV_VOLT_IN) {
//// for(i = 0; i < g_adcData.num; ++i) {
//// value_buf[i] = g_adcData.PV_VOLT_IN_array[i];
//// }
//// } else if (ADC_Channel == SYS_VOLT_IN) {
//// for(i = 0; i < g_adcData.num; ++i) {
//// value_buf[i] = g_adcData.SYS_VOLT_IN_array[i];
//// }
//// } else if (ADC_Channel == MOSFET_Temper) {
//// for(i = 0; i < g_adcData.num; ++i) {
//// value_buf[i] = g_adcData.MOSFET_Temper_array[i];
//// }
// } else {
// return 0;
// }
//
// /*从小到大冒泡排序*/
// for(j = 0; j < g_adcData.num-1; ++j)
// {
// for(k = 0; k < g_adcData.num-j-1; ++k)
// {
// if(value_buf[k] > value_buf[k+1])
// {
// temp = value_buf[k];
// value_buf[k] = value_buf[k+1];
// value_buf[k+1] = temp;
// }
// }
// }
//
// for(i = 2; i < g_adcData.num - 2; ++i)
// {
// sum += value_buf[i];
// }
//
// return sum / (g_adcData.num - 4);
}
#define N 6
/**
* @brief
@ -221,8 +312,9 @@ float get_CHG_CURR(void)
uint16_t I_ADC;
// I_ADC = Get_ConversionVal(get_adc(CHG_CURR));
// I_ADC = get_aftercalculationAdc(CHG_CURR);
I_ADC = g_adcData.total_CHG_CURR / g_adcData.num;
I_ADC = get_aftercalculationAdc(CHG_CURR);
// I_ADC = g_adcData.total_CHG_CURR / g_adcData.num;
// I_ADC = get_adc(CHG_CURR);
// I = (float)(I_ADC) / 4095 * 3.3 * P_CHG_CURR * 2;
@ -248,8 +340,9 @@ float get_PV_VOLT_OUT(void)
uint16_t V_ADC;
// V_ADC = Get_ConversionVal(get_adc(PV_VOLT_OUT));
V_ADC = get_aftercalculationAdc1(PV_VOLT_OUT);
// V_ADC = get_aftercalculationAdc(PV_VOLT_OUT);
V_ADC = g_adcData.total_PV_VOLT_OUT / g_adcData.num;
// V_ADC = g_adcData.total_PV_VOLT_OUT / g_adcData.num;
// V_ADC = get_adc(PV_VOLT_OUT);
V = (float)(V_ADC) * P_PV_VOLT_OUT;
@ -278,8 +371,8 @@ float get_DSG_CURR(void)
uint16_t I_ADC;
// I_ADC = Get_ConversionVal(get_adc(DSG_CURR));
// I_ADC = get_aftercalculationAdc(DSG_CURR);
I_ADC = g_adcData.total_DSG_CURR / g_adcData.num;
I_ADC = get_aftercalculationAdc(DSG_CURR);
// I_ADC = g_adcData.total_DSG_CURR / g_adcData.num;
// I_ADC = get_adc(DSG_CURR);
@ -299,15 +392,15 @@ float get_DSG_CURR(void)
* @param
* @retval V
*/
float get_PV1_VOLT_IN(void)
float get_PV_VOLT_IN(void)
{
float V;
uint16_t V_ADC;
// GPIO_WriteBit(G_FFMOS_CON1_GPIO, G_FFMOS_CON1_PIN, SET);
// V_ADC = Get_ConversionVal(get_adc(PV1_VOLT_IN));
// V_ADC = get_aftercalculationAdc(PV1_VOLT_IN);
V_ADC = g_adcData.total_PV1_VOLT_IN / g_adcData.num;
V_ADC = get_aftercalculationAdc1(PV_VOLT_IN);
// V_ADC = g_adcData.total_PV1_VOLT_IN / g_adcData.num;
// V_ADC = get_adc(PV1_VOLT_IN);
// GPIO_WriteBit(G_FFMOS_CON1_GPIO, G_FFMOS_CON1_PIN, RESET);
@ -327,14 +420,14 @@ float get_PV1_VOLT_IN(void)
* @param
* @retval V
*/
float get_PV_VOLT_IN1(void)
float get_SYS_VOLT_IN(void)
{
float V;
uint16_t V_ADC;
// V_ADC = Get_ConversionVal(get_adc(PV_VOLT_IN1));
// V_ADC = get_aftercalculationAdc(PV_VOLT_IN1);
V_ADC = g_adcData.total_PV_VOLT_IN1 / g_adcData.num;
V_ADC = get_aftercalculationAdc1(SYS_VOLT_IN);
// V_ADC = g_adcData.total_PV_VOLT_IN1 / g_adcData.num;
// V_ADC = get_adc(PV_VOLT_IN1);
V = (float)(V_ADC) * P_PV_VOLT_IN1;
@ -364,8 +457,8 @@ float get_MOSFET_Temper(void)
uint16_t T_ADC;
// T_ADC = Get_ConversionVal(get_adc(MOSFET_Temper));
// T_ADC = get_aftercalculationAdc(MOSFET_Temper);
T_ADC = g_adcData.total_MOSFET_Temper / g_adcData.num;
T_ADC = get_aftercalculationAdc1(MOSFET_Temper);
// T_ADC = g_adcData.total_MOSFET_Temper / g_adcData.num;
// char buffer[30];
// memset(buffer, 0, sizeof(buffer));
@ -396,31 +489,31 @@ float get_MOSFET_Temper(void)
return T;
}
/**
* @brief 2
* @param
* @retval V
*/
float get_PV2_VOLT_IN(void)
{
float V;
uint16_t V_ADC;
// GPIO_WriteBit(G_FFMOS_CON2_GPIO, G_FFMOS_CON2_PIN, SET);
// V_ADC = Get_ConversionVal(get_adc(PV2_VOLT_IN));
V_ADC = get_aftercalculationAdc(PV2_VOLT_IN);
// V_ADC = get_adc(PV2_VOLT_IN);
// GPIO_WriteBit(G_FFMOS_CON2_GPIO, G_FFMOS_CON2_PIN, RESET);
V = (float)(V_ADC) * P_PV2_VOLT_IN;
#ifdef enable_Printf_VI
printf("\n PV2_VOLT_IN ADC : %d \n", V_ADC);
printf(" PV2_VOLT_IN V : %d /100 \n", (int)(V * 100));
#endif
return V;
}
///**
// * @brief 得到光伏2开路电压
// * @param
// * @retval V 电压值
// */
//float get_PV2_VOLT_IN(void)
//{
// float V;
// uint16_t V_ADC;
//
//// GPIO_WriteBit(G_FFMOS_CON2_GPIO, G_FFMOS_CON2_PIN, SET);
//// V_ADC = Get_ConversionVal(get_adc(PV2_VOLT_IN));
//// V_ADC = get_aftercalculationAdc(PV2_VOLT_IN);
//// V_ADC = get_adc(PV2_VOLT_IN);
//// GPIO_WriteBit(G_FFMOS_CON2_GPIO, G_FFMOS_CON2_PIN, RESET);
//
// V = (float)(V_ADC) * P_PV2_VOLT_IN;
//
//#ifdef enable_Printf_VI
// printf("\n PV2_VOLT_IN ADC : %d \n", V_ADC);
// printf(" PV2_VOLT_IN V : %d /100 \n", (int)(V * 100));
//#endif
//
// return V;
//}

View File

@ -811,28 +811,27 @@ void test(void)
g_Mppt_Para.Charg_Current = get_CHG_CURR();
g_Mppt_Para.Discharg_Current = get_DSG_CURR();
g_Mppt_Para.Output_Voltage = get_PV_VOLT_OUT();
g_Mppt_Para.Input_Voltage = get_PV_VOLT_IN1();
g_Mppt_Para.HighSideMos_Temperature = get_MOSFET_Temper();
g_Mppt_Para.Solar_Open_Circuit_Voltage = get_PV1_VOLT_IN();
// g_Mppt_Para.Input_Voltage = get_SYS_VOLT_IN();
// g_Mppt_Para.HighSideMos_Temperature = get_MOSFET_Temper();
// g_Mppt_Para.Solar_Open_Circuit_Voltage = get_PV_VOLT_IN();
// printf("\n\n\n");
// printf("num = %d \n", g_adcData.num);
// printf("Charg_Current = %d/1000 \n", (int)(g_Mppt_Para.Charg_Current * 1000));
// printf("Output_Voltage = %d/1000 \n", (int)(g_Mppt_Para.Output_Voltage * 1000));
// printf("Discharg_Current = %d/1000 \n", (int)(g_Mppt_Para.Discharg_Current * 1000));
// printf("\n\n\n");
// printf("%d\n", g_adcData.num);
printf("%d\n", (int)(g_Mppt_Para.Charg_Current * 1000));
printf("%d\n", (int)(g_Mppt_Para.Output_Voltage * 1000));
printf("%d\r\n", (int)(g_Mppt_Para.Discharg_Current * 1000));
// printf("Input_Voltage = %d/1000 \n", (int)(g_Mppt_Para.Input_Voltage * 1000));
// printf("get_PV_VOLT_IN1 = %d/1000 \n", (int)(get_PV_VOLT_IN1() * 1000));
// printf("HighSideMos_Temperature = %d/1000 \n", (int)(g_Mppt_Para.HighSideMos_Temperature * 1000));
// printf("\n\n\n");
g_adcData.num = 0;
g_adcData.total_CHG_CURR = 0;
g_adcData.total_PV_VOLT_OUT = 0;
g_adcData.total_DSG_CURR = 0;
g_adcData.total_PV1_VOLT_IN = 0;
g_adcData.total_PV_VOLT_IN1 = 0;
g_adcData.total_MOSFET_Temper = 0;
// g_adcData.num = 0;
//// mppt_readjust();
//// Get_OutputPower();

View File

@ -155,6 +155,14 @@ void Task_RunLED(void)
// printf("HighSideMos_Temperature = %d/1000 \n", (int)(g_Mppt_Para.HighSideMos_Temperature * 1000));
// printf("\n\n\n");
// printf("%d\n", g_adcData.num);
// printf("%d\n", (int)(g_Mppt_Para.Charg_Current * 1000));
// printf("%d\n", (int)(g_Mppt_Para.Output_Voltage * 1000));
// printf("%d\n", (int)(g_Mppt_Para.Discharg_Current * 1000));
// printf("%d\n", (int)(g_Mppt_Para.Input_Voltage * 1000));
// printf("%d\n", (int)(g_Mppt_Para.Solar_Open_Circuit_Voltage * 1000));
// printf("%d\r\n", (int)(g_Mppt_Para.HighSideMos_Temperature * 1000));
static uint8_t flag = RESET;
flag = !flag;
GPIO_WriteBit(RUN_LED_GPIO, RUN_LED_PIN, flag);
@ -186,7 +194,7 @@ void Task_startMpptControl(void)
if (g_slConfigInfo.checkSolarOpenCircuitVTime == ++checkSolarOpenCircuitVTimeFlag) {
checkSolarOpenCircuitVTimeFlag = 0;
g_Mppt_Para.Solar_Open_Circuit_Voltage = get_PV1_VOLT_IN();
g_Mppt_Para.Solar_Open_Circuit_Voltage = get_PV_VOLT_IN();
// printf("volt in : %d/100 \n", (int)(g_Mppt_Para.Solar_Open_Circuit_Voltage * 100));
// char buff[50];
// memset(buff, 0, sizeof(buff));
@ -354,7 +362,7 @@ void Task_refreshRegister(void)
// g_Mppt_Para.DischargMos_State = GPIO_ReadOutputDataBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN);
// g_Mppt_Para.Solar_Open_Circuit_Voltage = get_capturedata(get_PV1_VOLT_IN);
g_Mppt_Para.Input_Voltage = get_PV1_VOLT_IN();
g_Mppt_Para.Input_Voltage = get_PV_VOLT_IN();
if (g_Mppt_Para.HighSideMos_Temperature < g_slConfigInfo.HighSideMosTemperature_start + 3) {
if (overTemperature == 2) {
@ -762,7 +770,7 @@ void g_Mppt_Para_Init(void)
g_Mppt_Para.Discharg_Current = get_DSG_CURR();
g_Mppt_Para.Battery_Voltage = g_Mppt_Para.Output_Voltage
- (g_Mppt_Para.Charg_Current - g_Mppt_Para.Discharg_Current) * g_impedance;
g_Mppt_Para.Solar_Open_Circuit_Voltage = get_PV1_VOLT_IN();
g_Mppt_Para.Solar_Open_Circuit_Voltage = get_PV_VOLT_IN();
g_Mppt_Para.HighSideMos_Temperature = get_MOSFET_Temper();
if (g_Mppt_Para.Battery_Voltage < 15 || g_Mppt_Para.Battery_Voltage > 11) {
@ -808,7 +816,6 @@ void task_Init(void)
// TimeSliceOffset_Register(&m_startMpptControl, Task_startMpptControl
// , startMpptControl_reloadVal, startMpptControl_offset);
TimeSliceOffset_Start(); /* Æô¶¯Ê±¼äƬÂÖѯ */
}
@ -838,8 +845,8 @@ void hardware_Init(void)
// uart_dev_write(g_bat485_uart3_handle, " hello world \n", sizeof(" hello world \n"));
// TIM3_Init(10);
// TIM_Cmd(TIM3, ENABLE); //TIM3ʹÄÜ
TIM3_Init(300);
TIM_Cmd(TIM3, ENABLE); //TIM3ʹÄÜ
g_duty_ratio = 0.8;
Set_duty_ratio(&g_duty_ratio);

View File

@ -19,6 +19,10 @@
//void rq_debug(const char *fmt, ...){};
//#endif
#define RQ_OK 1
#define RQ_ERROR 0
#define RQ_OVERFLOW -2
//³õʼ»¯¶ÓÁÐ
int InitRingQueue(RingQueue *q, RQ_ElementType *buff, int size)
{

View File

@ -11,9 +11,6 @@
//#define RING_QUEUE_DEBUG //定义本宏会打印RingQueue的调试信息
#define RQ_OK 1
#define RQ_ERROR 0
#define RQ_OVERFLOW -2
typedef unsigned char RQ_ElementType;//元素类型
typedef struct _ring_queue

View File

@ -0,0 +1,91 @@
/*
* ring_queue.c
*
* Created on: 2024621
* Author: psx
*/
//循环队列
#include <stdio.h>
#include <stdlib.h>
#include "ring_queue2.h"
#define RQ_OK 1
#define RQ_ERROR 0
#define RQ_OVERFLOW -2
//#define RING_QUEUE_DEBUG
//#ifdef RING_QUEUE_DEBUG
//#define //rq_debug term_printf
//#else
//void rq_debug(const char *fmt, ...){};
//#endif
//初始化队列
int InitRingQueue2(RingQueue2 *q, RQ_ElementType2 *buff, int size)
{
q->elems = buff;
q->size = size;
q->front=q->rear=0;
return RQ_OK;
}
//遍历队列,
//消费者使用故对生产者可能修改的rear先读取缓存
int ShowRingQueue2(RingQueue2 *q)
{
//int i;
int rear = q->rear;
if(q->front == rear)
{
//rq_debug("队列为空\n");
return RQ_ERROR;
}
//rq_debug("队列中的元素为:\n");
//for(i=((q->front)%q->size); i != rear; i=((i+1)%q->size))
//rq_debug(" %c\n",q->elems[i]);
//rq_debug("\n");
//rq_debug("队首元素为%c\n",q->elems[q->front]);
//rq_debug("队尾元素为%c\n",q->elems[rear - 1]);
return RQ_OK;
}
//向队尾插入元素e
int InRingQueue2(RingQueue2 *q,RQ_ElementType2 e)
{
if(RingQueueFull2(q))
{
//rq_debug("空间不足\n");
return(RQ_OVERFLOW);
}
q->elems[q->rear] = e;
q->rear = (q->rear+1) % q->size;
//rq_debug("rear = %d\n",q->rear);
return RQ_OK;
}
//从队首取回并删除元素
int OutRingQueue2(RingQueue2 *q, RQ_ElementType2 *e)
{
if(RingQueueEmpty2(q))
{
//rq_debug("队列为空\n");
return RQ_ERROR;
}
*e = q->elems[q->front];
//rq_debug("被删除的队首元素为%c\n",q->elems[q->front]);
q->front = (q->front+1) % q->size;
return RQ_OK;
}
//队列中的元素个数
int RingQueueLength2(RingQueue2 *q)
{
return ((q->rear - q->front) + q->size) % q->size;
}

View File

@ -0,0 +1,43 @@
/*
* ring_queue.h
*
* Created on: 2024621
* Author: psx
*/
#ifndef DRIVERS_RINGQUEUE_RING_QUEUE2_H_
#define DRIVERS_RINGQUEUE_RING_QUEUE2_H_
//#define RING_QUEUE_DEBUG //定义本宏会打印RingQueue的调试信息
typedef uint16_t RQ_ElementType2;//元素类型
typedef struct _ring_queue2
{
RQ_ElementType2 *elems;
int size;
volatile int front, rear;
}RingQueue2;
//初始化队列,需传入保存队列状态的结构q队列使用的buffer和buffer大小
int InitRingQueue2(RingQueue2 *q, RQ_ElementType2 *buff, int size);
#define RingQueueFull2(q) (((q)->rear+1) % (q)->size == (q)->front)
#define RingQueueEmpty2(q) ((q)->front == (q)->rear)
//遍历队列,
//消费者使用故对生产者可能修改的rear先读取缓存
int ShowRingQueue2(RingQueue2 *q);
//向队尾插入元素e
int InRingQueue2(RingQueue2 *q,RQ_ElementType2 e);
//从队首删除元素
int OutRingQueue2(RingQueue2 *q, RQ_ElementType2 *e);
//队列中的元素个数
int RingQueueLength2(RingQueue2 *q);
#endif /* DRIVERS_RINGQUEUE_RING_QUEUE_H_ */

View File

@ -2,6 +2,7 @@
#define __ADC_H
#include "ch32l103.h"
#include "ring_queue2.h"
//typedef struct _ADC_DATA {
// uint16_t total_CHG_CURR; /* 一个控制周期中adc采集的值之和 充电电流 */
@ -17,14 +18,25 @@
// 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 {
uint16_t num; /* 一个控制周期中adc采集次数之和 */
uint16_t total_CHG_CURR; /* 一个控制周期中adc采集的值之和 充电电流 */
uint16_t total_PV_VOLT_OUT; /* 输出电压 */
uint16_t total_DSG_CURR; /* 放电电流 */
uint16_t total_PV1_VOLT_IN; /* 太阳能板输出电压 */
uint16_t total_PV_VOLT_IN1; /* 系统输入电压 */
uint16_t total_MOSFET_Temper; /* mos管温度 */
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;

View File

@ -14,7 +14,8 @@ void ADC_all_Init(void)
RCC_PB2PeriphClockCmd(RCC_PB2Periph_ADC1, ENABLE);
RCC_ADCCLKConfig(RCC_PCLK2_Div2);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7; //PA1~7对应ADC通道1~7
// GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7; //PA1~7对应ADC通道1~7
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7; //PA1~7对应ADC通道1~7
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
GPIO_Init(GPIOA, &GPIO_InitStructure);
@ -51,8 +52,6 @@ void ADC_all_Init(void)
void DMA1_Channel1_IRQHandler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
/*
* ADC的DMA
*
@ -84,7 +83,7 @@ void DMA_Tx_Init(u32 memadr, u16 bufsize)
//初始化TIM NVIC设置中断优先级分组
NVIC_InitStructure.NVIC_IRQChannel = DMA1_Channel1_IRQn; //
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; //设置抢占优先级0
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1; //设置响应优先级3
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3; //设置响应优先级3
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //使能通道中断
NVIC_Init(&NVIC_InitStructure); //初始化NVIC
@ -129,7 +128,16 @@ void TIM1_Init1(u16 arr,u16 psc)
TIM_Cmd(TIM1, ENABLE);
}
#define CHG_CURR ADC_Channel_1
#define PV_VOLT_OUT ADC_Channel_2
#define DSG_CURR ADC_Channel_3
#define PV_VOLT_IN ADC_Channel_4
#define SYS_VOLT_IN ADC_Channel_5
#define MOSFET_Temper ADC_Channel_6
#define PV2_VOLT_IN ADC_Channel_7
static uint16_t CHG_CURR_buff[adcBuffSize];
static uint16_t DSG_CURR_buff[adcBuffSize];
/*
* DMA完成adc的采集
@ -137,9 +145,26 @@ void TIM1_Init1(u16 arr,u16 psc)
* ADC通过DMA的通道1完成数据的传输
*
* */
volatile uint16_t ADC_ConvertedValue[6]; //ADC采样的数据
volatile uint16_t ADC_ConvertedValue[2]; //ADC采样的数据
void ADC_TIM_DMA_Init(void)
{
InitRingQueue2(&g_adcData.RQCHG_CURR, CHG_CURR_buff, adcBuffSize);
InitRingQueue2(&g_adcData.RQDSG_CURR, DSG_CURR_buff, adcBuffSize);
for (int var = 0; var < adcBuffSize; ++var) {
InRingQueue2(&g_adcData.RQCHG_CURR, 0);
InRingQueue2(&g_adcData.RQDSG_CURR, 0);
}
// while (RingQueueLength2(&g_adcData.RQCHG_CURR) != adcBuffSize) {
// InRingQueue2(&g_adcData.RQCHG_CURR, 0);
// };
g_adcData.total_CHG_CURR = 0;
// while (RingQueueLength2(&g_adcData.RQDSG_CURR) != adcBuffSize) {
// InRingQueue2(&g_adcData.RQDSG_CURR, 0);
// };
g_adcData.total_DSG_CURR = 0;
ADC_InitTypeDef ADC_InitStructure = {0};
GPIO_InitTypeDef GPIO_InitStructure = {0};
@ -147,7 +172,10 @@ void ADC_TIM_DMA_Init(void)
RCC_PB2PeriphClockCmd(RCC_PB2Periph_ADC1, ENABLE);
RCC_ADCCLKConfig(RCC_PCLK2_Div2);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6; //PA1~7对应ADC通道1~7
// GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6; //PA1~7对应ADC通道1~7
// GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
// GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_3; //PA1~7对应ADC通道1~7
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
GPIO_Init(GPIOA, &GPIO_InitStructure);
@ -160,7 +188,7 @@ void ADC_TIM_DMA_Init(void)
ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1;
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
// ADC_InitStructure.ADC_NbrOfChannel = 1;
ADC_InitStructure.ADC_NbrOfChannel = 6;
ADC_InitStructure.ADC_NbrOfChannel = 2;
ADC_Init(ADC1, &ADC_InitStructure);
//使能ADC、DMA
@ -178,20 +206,23 @@ void ADC_TIM_DMA_Init(void)
ADC_StartCalibration(ADC1);
while(ADC_GetCalibrationStatus(ADC1));
ADC_RegularChannelConfig(ADC1, ADC_Channel_1, 1, ADC_SampleTime_CyclesMode5);
ADC_RegularChannelConfig(ADC1, ADC_Channel_2, 2, ADC_SampleTime_CyclesMode5);
ADC_RegularChannelConfig(ADC1, ADC_Channel_3, 3, ADC_SampleTime_CyclesMode5);
ADC_RegularChannelConfig(ADC1, ADC_Channel_4, 4, ADC_SampleTime_CyclesMode5);
ADC_RegularChannelConfig(ADC1, ADC_Channel_5, 5, ADC_SampleTime_CyclesMode5);
ADC_RegularChannelConfig(ADC1, ADC_Channel_6, 6, ADC_SampleTime_CyclesMode5);
// ADC_RegularChannelConfig(ADC1, CHG_CURR, 1, ADC_SampleTime_CyclesMode5);
// ADC_RegularChannelConfig(ADC1, PV_VOLT_OUT, 2, ADC_SampleTime_CyclesMode5);
// ADC_RegularChannelConfig(ADC1, DSG_CURR, 3, ADC_SampleTime_CyclesMode5);
// ADC_RegularChannelConfig(ADC1, PV_VOLT_IN, 4, ADC_SampleTime_CyclesMode5);
// ADC_RegularChannelConfig(ADC1, SYS_VOLT_IN, 5, ADC_SampleTime_CyclesMode5);
// ADC_RegularChannelConfig(ADC1, MOSFET_Temper, 6, ADC_SampleTime_CyclesMode5);
ADC_RegularChannelConfig(ADC1, CHG_CURR, 1, ADC_SampleTime_CyclesMode5);
ADC_RegularChannelConfig(ADC1, DSG_CURR, 2, ADC_SampleTime_CyclesMode5);
// /* 设置定时器输出的周期为1S */
// TIM1_Init1(1000, 48000);
/* 设置定时器输出的周期为30mS */
TIM1_Init1(30, 48000);
// TIM1_Init1(30, 48000);
/* 设置定时器输出的周期为100uS */
// TIM1_Init1(100, 48);
DMA_Tx_Init((u32)&ADC_ConvertedValue, 6);
TIM1_Init1(10, 48000);
DMA_Tx_Init((u32)&ADC_ConvertedValue, 2);
@ -241,21 +272,44 @@ void DMA1_Channel1_IRQHandler(void)
// printf("\r\nEnter DMA interrupt\r\n");
if(DMA_GetITStatus(DMA1_IT_TC1)!=RESET)
{
DMA_ClearITPendingBit(DMA1_IT_TC1);
//中断处理代码
static uint16_t temp;
OutRingQueue2(&g_adcData.RQCHG_CURR, &temp);
g_adcData.total_CHG_CURR -= temp;
OutRingQueue2(&g_adcData.RQDSG_CURR, &temp);
g_adcData.total_DSG_CURR -= temp;
g_adcData.total_CHG_CURR += ADC_ConvertedValue[0];
g_adcData.total_DSG_CURR += ADC_ConvertedValue[1];
InRingQueue2(&g_adcData.RQCHG_CURR, ADC_ConvertedValue[0]);
InRingQueue2(&g_adcData.RQDSG_CURR, ADC_ConvertedValue[1]);
DMA_ClearITPendingBit(DMA1_IT_TC1);
// g_adcData.CHG_CURR_array[g_adcData.num] = Get_ConversionVal1(ADC_ConvertedValue[0]);
// g_adcData.PV_VOLT_OUT_array[g_adcData.num] = Get_ConversionVal1(ADC_ConvertedValue[1]);
// g_adcData.DSG_CURR_array[g_adcData.num] = Get_ConversionVal1(ADC_ConvertedValue[2]);
// g_adcData.PV_VOLT_IN_array[g_adcData.num] = Get_ConversionVal1(ADC_ConvertedValue[3]);
// g_adcData.SYS_VOLT_IN_array[g_adcData.num] = Get_ConversionVal1(ADC_ConvertedValue[4]);
// g_adcData.MOSFET_Temper_array[g_adcData.num] = Get_ConversionVal1(ADC_ConvertedValue[5]);
// g_adcData.num++;
// g_adcData.CHG_CURR_array[g_adcData.num] = ADC_ConvertedValue[0];
// g_adcData.DSG_CURR_array[g_adcData.num] = ADC_ConvertedValue[1];
// g_adcData.PV_VOLT_OUT_array[g_adcData.num] = ADC_ConvertedValue[2];
// g_adcData.num++;
// g_adcData.total_CHG_CURR += Get_ConversionVal1(ADC_ConvertedValue[0]);
// g_adcData.total_PV_VOLT_OUT += Get_ConversionVal1(ADC_ConvertedValue[1]);
// g_adcData.total_DSG_CURR += Get_ConversionVal1(ADC_ConvertedValue[2]);
// g_adcData.total_PV1_VOLT_IN += Get_ConversionVal1(ADC_ConvertedValue[3]);
// g_adcData.total_PV_VOLT_IN1 += Get_ConversionVal1(ADC_ConvertedValue[4]);
// g_adcData.total_MOSFET_Temper += Get_ConversionVal1(ADC_ConvertedValue[5]);
// g_adcData.num++;
// g_adcData.total_CHG_CURR += Get_ConversionVal1(ADC_ConvertedValue[0]);
printf("%d\n", ADC_ConvertedValue[1]);
printf("%d\r\n", ADC_ConvertedValue[2]);
// printf("%d\n", ADC_ConvertedValue[0]);
// printf("%d\n", ADC_ConvertedValue[1]);
// printf("%d\n", ADC_ConvertedValue[3]);
// printf("%d\n", ADC_ConvertedValue[4]);
// printf("%d\r\n", ADC_ConvertedValue[5]);
// g_adcData.total_PV_VOLT_OUT += Get_ConversionVal1(ADC_ConvertedValue[1]);
// g_adcData.total_DSG_CURR += Get_ConversionVal1(ADC_ConvertedValue[2]);

View File

@ -47,7 +47,7 @@ void TIM3_Int_Init(uint16_t arr, uint16_t psc)
//初始化TIM NVIC设置中断优先级分组
NVIC_InitStructure.NVIC_IRQChannel = TIM3_IRQn; //TIM3中断
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; //设置抢占优先级0
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1; //ÉèÖÃÏìÓ¦ÓÅÏȼ¶3
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3; //ÉèÖÃÏìÓ¦ÓÅÏȼ¶3
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //使能通道1中断
NVIC_Init(&NVIC_InitStructure); //初始化NVIC
@ -91,7 +91,7 @@ void TIM2_Int_Init(uint16_t arr, uint16_t psc)
//初始化TIM NVIC设置中断优先级分组
NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn; //TIM2中断
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; //设置抢占优先级0
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3; //ÉèÖÃÏìÓ¦ÓÅÏȼ¶3
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2; //ÉèÖÃÏìÓ¦ÓÅÏȼ¶3
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //使能通道1中断
NVIC_Init(&NVIC_InitStructure); //初始化NVIC

View File

@ -26,8 +26,9 @@ App/src/collect_Conversion.o: ../App/src/collect_Conversion.c \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_misc.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_lptim.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_opa.h \
D:\psx\MPPT\git\Hardware\inc/adc.h D:\psx\MPPT\git\Hardware\inc/gpio.h \
D:\psx\MPPT\git\App\inc/uart_dev.h \
D:\psx\MPPT\git\Hardware\inc/adc.h \
D:\psx\MPPT\git\Drivers\RingQueue2/ring_queue2.h \
D:\psx\MPPT\git\Hardware\inc/gpio.h D:\psx\MPPT\git\App\inc/uart_dev.h \
D:\psx\MPPT\git\Drivers\RingQueue/ring_queue.h \
D:\psx\MPPT\git\Hardware\inc/rs485.h
@ -91,6 +92,8 @@ D:\psx\MPPT\git\Peripheral\inc/ch32l103_opa.h:
D:\psx\MPPT\git\Hardware\inc/adc.h:
D:\psx\MPPT\git\Drivers\RingQueue2/ring_queue2.h:
D:\psx\MPPT\git\Hardware\inc/gpio.h:
D:\psx\MPPT\git\App\inc/uart_dev.h:

Binary file not shown.

View File

@ -27,8 +27,10 @@ App/src/mppt_control.o: ../App/src/mppt_control.c \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_lptim.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_opa.h \
D:\psx\MPPT\git\App\inc/collect_Conversion.h \
D:\psx\MPPT\git\Hardware\inc/adc.h D:\psx\MPPT\git\Hardware\inc/pwm.h \
D:\psx\MPPT\git\App\inc/inflash.h D:\psx\MPPT\git\Hardware\inc/gpio.h \
D:\psx\MPPT\git\Hardware\inc/adc.h \
D:\psx\MPPT\git\Drivers\RingQueue2/ring_queue2.h \
D:\psx\MPPT\git\Hardware\inc/pwm.h D:\psx\MPPT\git\App\inc/inflash.h \
D:\psx\MPPT\git\Hardware\inc/gpio.h \
D:\psx\MPPT\git\App\inc/sl_protocol.h D:\psx\MPPT\git\App\inc/uart_dev.h \
D:\psx\MPPT\git\Drivers\RingQueue/ring_queue.h \
D:\psx\MPPT\git\Hardware\inc/rs485.h D:\psx\MPPT\git\App\inc/task.h \
@ -97,6 +99,8 @@ D:\psx\MPPT\git\App\inc/collect_Conversion.h:
D:\psx\MPPT\git\Hardware\inc/adc.h:
D:\psx\MPPT\git\Drivers\RingQueue2/ring_queue2.h:
D:\psx\MPPT\git\Hardware\inc/pwm.h:
D:\psx\MPPT\git\App\inc/inflash.h:

Binary file not shown.

View File

@ -31,6 +31,6 @@ C_DEPS += \
# Each subdirectory must supply rules for building sources it contributes
App/src/%.o: ../App/src/%.c
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @

View File

@ -30,8 +30,9 @@ App/src/task.o: ../App/src/task.c D:\psx\MPPT\git\App\inc/task.h \
D:\psx\MPPT\git\Drivers\RingQueue/ring_queue.h \
D:\psx\MPPT\git\Hardware\inc/rs485.h D:\psx\MPPT\git\App\inc/uart_dev.h \
D:\psx\MPPT\git\Hardware\inc/tim.h D:\psx\MPPT\git\Hardware\inc/pwm.h \
D:\psx\MPPT\git\Hardware\inc/adc.h D:\psx\MPPT\git\Hardware\inc/gpio.h \
D:\psx\MPPT\git\Hardware\inc/flash.h \
D:\psx\MPPT\git\Hardware\inc/adc.h \
D:\psx\MPPT\git\Drivers\RingQueue2/ring_queue2.h \
D:\psx\MPPT\git\Hardware\inc/gpio.h D:\psx\MPPT\git\Hardware\inc/flash.h \
D:\psx\MPPT\git\App\inc/sl_protocol.h \
D:\psx\MPPT\git\App\inc/mppt_control.h D:\psx\MPPT\git\App\inc/inflash.h \
D:\psx\MPPT\git\App\inc/collect_Conversion.h
@ -110,6 +111,8 @@ D:\psx\MPPT\git\Hardware\inc/pwm.h:
D:\psx\MPPT\git\Hardware\inc/adc.h:
D:\psx\MPPT\git\Drivers\RingQueue2/ring_queue2.h:
D:\psx\MPPT\git\Hardware\inc/gpio.h:
D:\psx\MPPT\git\Hardware\inc/flash.h:

Binary file not shown.

Binary file not shown.

View File

@ -16,6 +16,6 @@ C_DEPS += \
# Each subdirectory must supply rules for building sources it contributes
Core/%.o: ../Core/%.c
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @

View File

@ -16,6 +16,6 @@ C_DEPS += \
# Each subdirectory must supply rules for building sources it contributes
Debug/%.o: ../Debug/%.c
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @

Binary file not shown.

View File

@ -16,6 +16,6 @@ C_DEPS += \
# Each subdirectory must supply rules for building sources it contributes
Drivers/RingQueue/%.o: ../Drivers/RingQueue/%.c
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @

View File

@ -0,0 +1,4 @@
Drivers/RingQueue2/ring_queue2.o: ../Drivers/RingQueue2/ring_queue2.c \
../Drivers/RingQueue2/ring_queue2.h
../Drivers/RingQueue2/ring_queue2.h:

Binary file not shown.

View File

@ -0,0 +1,21 @@
################################################################################
# MRS Version: 1.9.0
# 自动生成的文件。不要编辑!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../Drivers/RingQueue2/ring_queue2.c
OBJS += \
./Drivers/RingQueue2/ring_queue2.o
C_DEPS += \
./Drivers/RingQueue2/ring_queue2.d
# Each subdirectory must supply rules for building sources it contributes
Drivers/RingQueue2/%.o: ../Drivers/RingQueue2/%.c
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @

View File

@ -16,6 +16,6 @@ C_DEPS += \
# Each subdirectory must supply rules for building sources it contributes
Drivers/TimeSliceOffset/%.o: ../Drivers/TimeSliceOffset/%.c
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @

View File

@ -25,7 +25,8 @@ Hardware/src/adc.o: ../Hardware/src/adc.c \
D:\psx\MPPT\git\User/ch32l103_it.h D:\psx\MPPT\git\Debug/debug.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_misc.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_lptim.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_opa.h
D:\psx\MPPT\git\Peripheral\inc/ch32l103_opa.h \
D:\psx\MPPT\git\Drivers\RingQueue2/ring_queue2.h
D:\psx\MPPT\git\Hardware\inc/adc.h:
@ -84,3 +85,5 @@ D:\psx\MPPT\git\Peripheral\inc/ch32l103_misc.h:
D:\psx\MPPT\git\Peripheral\inc/ch32l103_lptim.h:
D:\psx\MPPT\git\Peripheral\inc/ch32l103_opa.h:
D:\psx\MPPT\git\Drivers\RingQueue2/ring_queue2.h:

Binary file not shown.

Binary file not shown.

View File

@ -31,6 +31,6 @@ C_DEPS += \
# Each subdirectory must supply rules for building sources it contributes
Hardware/src/%.o: ../Hardware/src/%.c
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @

Binary file not shown.

View File

@ -76,6 +76,6 @@ C_DEPS += \
# Each subdirectory must supply rules for building sources it contributes
Peripheral/src/%.o: ../Peripheral/src/%.c
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @

View File

@ -22,6 +22,6 @@ C_DEPS += \
# Each subdirectory must supply rules for building sources it contributes
User/%.o: ../User/%.c
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @

View File

@ -14,6 +14,7 @@ RM := rm -rf
-include Peripheral/src/subdir.mk
-include Hardware/src/subdir.mk
-include Drivers/TimeSliceOffset/subdir.mk
-include Drivers/RingQueue2/subdir.mk
-include Drivers/RingQueue/subdir.mk
-include Debug/subdir.mk
-include Core/subdir.mk

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -27,6 +27,7 @@ App/src \
Core \
Debug \
Drivers/RingQueue \
Drivers/RingQueue2 \
Drivers/TimeSliceOffset \
Hardware/src \
Peripheral/src \