1、配置ADC
2、配置DMA
3、DMA转换数据到数组
/* USER CODE BEGIN Header_StartTaskModbus */ #define ADC_BUFFER_SIZE 8 // 根据规则通道数调整 uint32_t adc_buffer[ADC_BUFFER_SIZE]; // ADC采样结果缓冲区 /** * @brief Function implementing the myTaskModbus thread. * @param argument: Not used * @retval None */ /* USER CODE END Header_StartTaskModbus */ void StartTaskModbus(void const * argument) { /* USER CODE BEGIN StartTaskModbus */ /* Infinite loop */ for(;;) { HAL_ADC_Start_DMA(&hadc1, adc_buffer, ADC_BUFFER_SIZE); // 开始ADC规则通道的DMA传输 osDelay(10); } /* USER CODE END StartTaskModbus */ }
4、调试结果
标签:DMA,CODE,BUFFER,StartTaskModbus,单端,ADC,STM32H723,USER From: https://www.cnblogs.com/lizhiqiang0204/p/18671039