实验原理:
STM32内部集成三个12位ADC,iCore1S的所有电源经过电阻分压或者直接
接入STM32的ADC的输出通道内,输入电流经过高端电流检测芯片ZXCT1009F
输入到ADC的输入通道内,从而实现电源监控功能。
核心代码:
int main(void)
{
/* USER CODE BEGIN 1 */
int i;
/* USER CODE END 1 */
/* MCU Configuration----------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_ADC3_Init();
MX_USART6_UART_Init();
/* USER CODE BEGIN 2 */
usart6.initialize(115200);
LED_GREEN_ON;
usart6.printf("x0c");
usart6.printf("