金牌会员
- 积分
- 1619
- 威望
- 809
- 贡献
- 480
- 兑换币
- 461
- 注册时间
- 2014-10-18
- 在线时间
- 165 小时
- 毕业学校
- 温岭中学
|
机遇 发表于 2015-1-30 14:29
pwmout 程序呢
void PWMOUT()
{
//turnPWM=0;
rightPWMOUT=-turnPWM;//;
leftPWMOUT=turnPWM;//;
if(rightPWMOUT>=80) rightPWMOUT=80;
if(rightPWMOUT<-80) rightPWMOUT=-80;
if(leftPWMOUT>=80) leftPWMOUT=80;
if(leftPWMOUT<-80) leftPWMOUT=-80;
if(rightPWMOUT>=0)
{
FTM_PWM_init(FTM0,CH0,3000,6+rightPWMOUT);
FTM_PWM_init(FTM0,CH1,3000,0);
}
if(rightPWMOUT<0)
{
FTM_PWM_init(FTM0,CH0,3000,0);
FTM_PWM_init(FTM0,CH1,3000,6-rightPWMOUT);
}
if(leftPWMOUT>=0)
{
FTM_PWM_init(FTM0,CH2,3000,6+leftPWMOUT);
FTM_PWM_init(FTM0,CH3,3000,0);
}
if(leftPWMOUT<0)
{
FTM_PWM_init(FTM0,CH2,3000,0);
FTM_PWM_init(FTM0,CH3,3000,6-leftPWMOUT);
}
}
|
|