大学生
最后登录1970-1-1
在线时间 小时
注册时间2019-10-18
|
#include "stm32f10x.h"
#include "bsp_Tim.h"
#include "bsp_led.h"
#include "bsp_systick.h"
uint16_t time=0;
int main(void)
{
ADVANCE_TIM_Init();
while(1)
{
TIM_SetCompare1(TIM1,500);
Sys_ms(2);
TIM_SetCompare1(TIM1,1000);
Sys_ms(2);
TIM_SetCompare1(TIM1,1500);
Sys_ms(2);
TIM_SetCompare1(TIM1,2000);
Sys_ms(2);
TIM_SetCompare1(TIM1,5500);
Sys_ms(2);
}
}
// PWM 信号的频率 F = TIM_CLK/{(ARR+1)*(PSC+1)}
#define ADVANCE_TIM_PERIOD (9999-1)
#define ADVANCE_TIM_PSC (144-1)
#define ADVANCE_TIM_PULSE 5000
这样设置后,连接到舵机,舵机不动,就是能听到里面一滴一滴的声音,很像卡死了
|
|