标准差为7

This commit is contained in:
wantong
2024-03-15 16:35:04 +08:00
parent 8351fa5d29
commit 8a88f505bd
149 changed files with 1265 additions and 1065 deletions

View File

@ -52,7 +52,7 @@ void MX_ADC1_Init(void);
/* 函数声明 */
void adc_init(void); /* 初始化ADC */
uint32_t adc_get_result(uint32_t ch); /* 获取ADC转换后的结果 */
//uint32_t adc_get_result_average(uint32_t ch, uint8_t times); /* 获取ADC转换且进行均值滤波后的结果 */
uint32_t adc_get_result_average(uint32_t ch, uint8_t times); /* 获取ADC转换且进行均值滤波后的结果 */
void adc_11_int(void);
/* USER CODE END Prototypes */

View File

@ -60,21 +60,18 @@ void adc_11_int(void)
HAL_ADC_ConfigChannel(&g_adc_handle, &adc_ch_conf); /* 通道配置 */
HAL_ADC_Start(&g_adc_handle); /* 开启ADC */
HAL_ADC_PollForConversion(&g_adc_handle, 10);
HAL_ADC_PollForConversion(&g_adc_handle, 10); /* ÂÖѯת»» */
}
uint32_t adc_get_result(uint32_t ch)
{
if (HAL_ADC_PollForConversion(&g_adc_handle, 10) == HAL_OK) {
return HAL_ADC_GetValue(&g_adc_handle); /* 返回最近一次ADC1常规组的转换结果 */
}
else{
return 0xffff;
}
}else{
return 0xFFFF;
}
}

View File

@ -94,15 +94,15 @@ extern ADC_HandleTypeDef g_adc_handle; /* ADC
uint16_t adc_value;
int enc1,enc0=6000;
int enc2;
uint8_t buf[2500];
uint8_t buf[2900];
uint8_t buf1[29]={0X0A,0X0A,0X0A,0X0A,0X0A,0X0A,0X0A,0X0A};
int adc_array_size= 1520;
int average_value[100][300];
int enc3[100][300];
//uint16_t adc_array[1520];
//uint16_t ev_co[1520];
int average_value[100][400];
int enc3[100][400];
uint16_t adc_array[1520];
uint16_t ev_co[1520];
int measure_f=0;
int track_array[300];
int track_array[400];
/* USER CODE END 0 */
/**
@ -179,6 +179,7 @@ int main(void)
measure_f=0;
enc1 = __HAL_TIM_GET_COUNTER(&htim2);//获取定时器的值
enc2 = enc1;
while(abs(enc2-enc1)==0)
{
@ -203,10 +204,19 @@ int main(void)
}
CDC_Transmit_HS(buf, 8*track_array[k]);
HAL_Delay(1);
HAL_Delay(2);
}
HAL_Delay(2);
// if(enc2-enc0>1000)
// {
//// HAL_Delay(5000);
//// HAL_Delay(5000);
//// enc0=6000;
//// CDC_Transmit_HS(buf1, 8);
// }
}
/* USER CODE END 3 */
}

Some files were not shown because too many files have changed in this diff Show More