Stm32F407_PWM_External_Sync
Post:2022-01-18 21:42:09
Tags:/
STM32
/
Visit:
1.PWM与外部触发信号同步
new progect
CubeMX Setting
RCC->Cystal
SYS->Serial Wire
Clock Configuration->168
TIM1
Save
2.Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| int main(void) {
HAL_Init();
SystemClock_Config();
MX_GPIO_Init(); MX_TIM1_Init(); HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1); HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_2); HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_3); HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_4);
while (1) {
} }
|
3.Test