在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
芯片精品文章合集(500篇!)    创芯人才网--重磅上线啦!
查看: 2995|回复: 1

[原创] 请教F281x_pwm程序模块问题!!

[复制链接]
发表于 2008-7-16 09:28:22 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
本帖最后由 cjsb37 于 2013-4-29 09:04 编辑

如下是TI公司PWM更新模块,请问程序中这两步        
    Tmp = (int32)MPeriod*(int32)p->MfuncC1;                    // Q15 = Q0*Q15
        EvaRegs.CMPR1 = (int16)(Tmp>>16) + (int16)(MPeriod>>1);    // Q0 = (Q15->Q0)/2 + (Q0/2)
有什么作用,希望明白的高人多指教,非常感谢!!!
void F281X_EV1_PWM_Update(PWMGEN *p)
{      
                int16 MPeriod;
        int32 Tmp;
// Compute the timer period (Q0) from the period modulation input (Q15)
        Tmp = (int32)p-&gteriodMax*(int32)p->MfuncPeriod;           // Q15 = Q0*Q15
        MPeriod = (int16)(Tmp>>16) + (int16)(p-&gteriodMax>>1);     // Q0 = (Q15->Q0)/2 + (Q0/2)        EvaRegs.T1PR = MPeriod;  
// Compute the compare 1 (Q0) from the PWM 1&2 duty cycle ratio (Q15)
       Tmp = (int32)MPeriod*(int32)p->MfuncC1;                    // Q15 = Q0*Q15
        EvaRegs.CMPR1 = (int16)(Tmp>>16) + (int16)(MPeriod>>1);    // Q0 = (Q15->Q0)/2 + (Q0/2)
// Compute the compare 2 (Q0) from the PWM 3&4 duty cycle ratio (Q15)
        Tmp = (int32)MPeriod*(int32)p->MfuncC2;                   // Q15 = Q0*Q15
        EvaRegs.CMPR2 = (int16)(Tmp>>16) + (int16)(MPeriod>>1);   // Q0 = (Q15->Q0)/2 + (Q0/2)
// Compute the compare 3 (Q0) from the PWM 5&6 duty cycle ratio (Q15)
        Tmp = (int32)MPeriod*(int32)p->MfuncC3;                   // Q15 = Q0*Q15
        EvaRegs.CMPR3 = (int16)(Tmp>>16) + (int16)(MPeriod>>1);   // Q0 = (Q15->Q0)/2 + (Q0/2)
        
}







发表于 2008-7-21 14:17:58 | 显示全部楼层
自己参考PWM DATASHEET 啊,类似占空比的东西
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-5-21 15:18 , Processed in 0.029199 second(s), 9 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表