如图红色部分的条件语句中的表达式不明白,还请高手指点
switch(Mod) //根据模式设定TACCRx
{
case 2: case 6: /**死区模式2,6时,需要判断修正死区时间,且同时设定TA0CCR1/2 的值*/
{
if((1000-2*Percent)<=DeadPermill) //为何这样计算?
Percent=(1000-DeadPermill)/2; //?
TA0CCR1=Percent*TA0CCR0/1000; //??
TA0CCR2= TA0CCR0-TA0CCR1; //这是什么意思?为什么这么运算?
break;
}
case 7:
{
if(Percent>1000) Percent=1000;
if(Channel==1) TA0CCR1=Percent* TA0CCR0/1000;
if(Channel==2) TA0CCR2=Percent* TA0CCR0/1000;
break;
}
case 3: //占空比一律为正脉宽,所以需要 TA0CCR0减去占空比
{
if(Percent>1000) Percent=1000;
if(Channel==1) TA0CCR1= TA0CCR0-Percent*TA0CCR0/1000;
if(Channel==2) TA0CCR2= TA0CCR0-Percent*TA0CCR0/1000;
break;
}
default: return(0);
}
return (1);
}