问题如题。 程序如下,现在测量PB0上是一个高电平信号。根据官方的例程《PWM_Output》修改。 void PWM_Init(void) { TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; TIM_OCInitTypeDef TIM_OCInitStructure; GPIO_InitTypeDef GPIO_InitStructure; uint16_t PrescalerValue = 0; RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE); RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_40MHz; GPIO_Init(GPIOB, &GPIO_InitStructure); GPIO_PinAFConfig(GPIOB, GPIO_PinSource0, GPIO_AF_TIM3); PrescalerValue = (uint16_t) (SystemCoreClock / 8000000) - 1; TIM_TimeBaseStructure.TIM_Period = 159; TIM_TimeBaseStructure.TIM_Prescaler = PrescalerValue; TIM_TimeBaseStructure.TIM_ClockDivision = 0; TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure); TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1; TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable; TIM_OCInitStructure.TIM_Pulse = 80; TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High; TIM_OC1Init(TIM3, &TIM_OCInitStructure); TIM_OC1PreloadConfig(TIM3, TIM_OCPreload_Enable); TIM_ARRPreloadConfig(TIM3, ENABLE); TIM_Cmd(TIM3, ENABLE); } |
STM32L152 RTC唤醒STOP mode问题
STM32L152系列自带LCD驱动段码液晶屏,怎么驱动想要亮的段亮
STM32L151为何FLASH擦除后全是是0x00?
求助!!STM32L151中的RTC唤醒(wake up)中断问题
STM32L152普通I/O模拟SPI驱动W25Q16问题
STM32L152开发板原理图及说明文档
STM32L1系列,如何释放PA15为普通GPIO端口
STM32L151读取W25Q16的ID错误,请帮忙看看是什么原因
STM32L151 STOP模式唤醒程序跑哪儿了
STM32L152驱动段码LCD问题?
RE:STM32L151CB 在PB0上输出一个占空比1:1的50KHz的PWM
RE:STM32L151CB 在PB0上输出一个占空比1:1的50KHz的PWM
TIM_CtrlPWMOutputs(TIM3, ENABLE);
回复:STM32L151CB 在PB0上输出一个占空比1:1的50KHz的PWM
最后怎么没有 PWM输出使能~
TIM_CtrlPWMOutputs(TIM3, ENABLE);
我用的这个库函数里面没有这个函数。
RE:STM32L151CB 在PB0上输出一个占空比1:1的50KHz的PWM