代码拉取完成,页面将自动刷新
通过定时来模拟24路PWM输出demo
void tim_Task(void)//20us
{
time++;
if (time >= 1000)//周期
time = 0;
if (time <= Servo_Actions[0])//角度占空比=25+(100/180)*角度
PWM1_H;
else
PWM1_L;
if (time <= Servo_Actions[1])
PWM2_H;
else
PWM2_L;
if (time <= Servo_Actions[2])
PWM3_H;
else
PWM3_L;
if (time <= Servo_Actions[3])
PWM4_H;
else
PWM4_L;
if (time <= Servo_Actions[4])
PWM5_H;
else
PWM5_L;
if (time <= Servo_Actions[5])
PWM6_H;
else
PWM6_L;
if (time <= Servo_Actions[6])
PWM7_H;
else
PWM7_L;
if (time <= Servo_Actions[7])
PWM8_H;
else
PWM8_L;
if (time <= Servo_Actions[8])
PWM9_H;
else
PWM9_L;
if (time <= Servo_Actions[9])
PWM10_H;
else
PWM10_L;
if (time <= Servo_Actions[10])
PWM11_H;
else
PWM11_L;
if (time <= Servo_Actions[11])
PWM12_H;
else
PWM12_L;
if (time <= Servo_Actions[12])
PWM13_H;
else
PWM13_L;
if (time <= Servo_Actions[13])
PWM14_H;
else
PWM14_L;
if (time <= Servo_Actions[14])
PWM15_H;
else
PWM15_L;
if(time <= Servo_Actions[15])
PWM16_H;
else
PWM16_L;
if (time <= Servo_Actions[16])
PWM17_H;
else
PWM17_L;
if (time <= Servo_Actions[17])
PWM18_H;
else
PWM18_L;
if (time <= Servo_Actions[18])
PWM19_H;
else
PWM19_L;
if (time <= Servo_Actions[19])
PWM20_H;
else
PWM20_L;
if (time <= Servo_Actions[20])
PWM21_H;
else
PWM21_L;
if (time <= Servo_Actions[21])
PWM22_H;
else
PWM22_L;
if (time <= Servo_Actions[22])
PWM23_H;
else
PWM23_L;
if (time <= Servo_Actions[23])
PWM24_H;
else
PWM24_L;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。