本帖最后由 liao6 于 2025-10-14 08:55 编辑
1.配置 未打开中断
2.生成代码 int main(void) { /* USER CODE BEGIN 1 */ // // SEG[0]output S3 [6]input S34 // uint8_t g_u8DisOutInput[4] = { 0xC0, 0x20, 0x30, 0x40}; // uint8_t u8LcdUpdataDis[16] = {0}; /* 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_TIM15_Init(); /* USER CODE BEGIN 2 */ HAL_TIM_PWM_Start(&htim15,TIM_CHANNEL_1); //启动PWM __HAL_TIM_SET_COMPARE(&htim15,TIM_CHANNEL_1,500); //重装载值:1000,占空比-50% /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ } /* USER CODE END 3 */ }
|