#include "stm32f10x.h"
void PWM_Init(u16 arr,u16 psc)
{
RCC->APB1ENR|=1<<1;
RCC->APB2ENR|=1<<2;
GPIOA->CRL&=0x0FFFFFFF;
GPIOA->CRL|=0x30000000;
GPIOA->ODR|=1<<7;
TIM3->ARR=arr;
TIM3->PSC=psc;
TIM3->CCMR1|=7<<12;
TIM3->CCMR1|=1<<11;
TIM3->CCER|=1<<4;
TIM3->CR1=0x0080;
TIM3->CR1|=0x01;
}
int main(void)
{
PWM_Init(899,0);
while(1)
{}
}
此帖出自
小平头技术问答
能帮忙解决一下吗,想看什么都可以
一周热门 更多>