请问函数里面195那些数据是什么意思,怎么知道它的占空比是多少
TIM_SetCompare1(TIM14,195);
int main(void)
{
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//éèÖÃÏμí3ÖD¶ÏóÅÏ輶·Ö×é2
delay_init(168); //3õê¼»ˉÑóê±oˉêy
uart_init(115200);//3õê¼»ˉ′®¿ú2¨ìØÂêÎa115200
TIM14_PWM_Init(199,8399); //84M/8400=10000μļÆêyÆμÂê,ÖØ×°ÔØÖμ200£¬ËùòÔ
WMÆμÂêÎa 10000/200=50. ¼′ÖüÆúÎa20ms
while(1) //êμÏÖ±è½ÏÖμ′ó0-300μYÔö£¬μ½300oó′ó300-0μY¼õ£¬Ñ-»·
{
TIM_SetCompare1(TIM14,195);
delay_ms(100);
TIM_SetCompare1(TIM14,190);
delay_ms(100);
TIM_SetCompare1(TIM14,185);
delay_ms(100);
TIM_SetCompare1(TIM14,180);
delay_ms(100);
TIM_SetCompare1(TIM14,175);
delay_ms(100);
TIM_SetCompare1(TIM14,170);
delay_ms(100);
TIM_SetCompare1(TIM14,175);
delay_ms(100);
TIM_SetCompare1(TIM14,180);
delay_ms(100);
TIM_SetCompare1(TIM14,185);
delay_ms(100);
TIM_SetCompare1(TIM14,190);
delay_ms(100);
TIM_SetCompare1(TIM14,195);
delay_ms(100);
}
}
是(重载值-这个值)和重载值的比值才是占空比吧?
一周热门 更多>