完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
下面一段程序的功能是检测同步机转子位置,不知思路是什么?
void SynInitPosDetSetPwm(Uint Section) { EALLOW; switch(Section) { case 0: // A+, B- EPwm1Regs.AQCSFRC.all = 0x08; EPwm2Regs.AQCSFRC.all = 0x02; EPwm3Regs.AQCSFRC.all = 0x0A; //1010? break; case 1: // A-, B+ EPwm1Regs.AQCSFRC.all = 0x02; EPwm2Regs.AQCSFRC.all = 0x08; EPwm3Regs.AQCSFRC.all = 0x0A; break; case 2: // B+, C- EPwm1Regs.AQCSFRC.all = 0x0A; EPwm2Regs.AQCSFRC.all = 0x08; EPwm3Regs.AQCSFRC.all = 0x02; break; case 3: // B-, C+ EPwm1Regs.AQCSFRC.all = 0x0A; EPwm2Regs.AQCSFRC.all = 0x02; EPwm3Regs.AQCSFRC.all = 0x08; break; case 4: // A-, C+ EPwm1Regs.AQCSFRC.all = 0x02; EPwm2Regs.AQCSFRC.all = 0x0A; EPwm3Regs.AQCSFRC.all = 0x08; break; case 5: // A+, C- EPwm1Regs.AQCSFRC.all = 0x08; EPwm2Regs.AQCSFRC.all = 0x0A; EPwm3Regs.AQCSFRC.all = 0x02; break; case 6: //恢复PWM模块的寄存器设置 EPwm1Regs.DBCTL.all = 0x0007; //OUT_MODE=11 POLSEL=01 EPwm1Regs.AQCTLA.all = 0x0090; //CAD=10 下降计数若比较相等,则Set: force EPWMxA output high;CAU=01 上升计数若比较相等,Clear: force EPWMxA output low EPwm1Regs.AQCTLB.all = 0x00; EPwm1Regs.AQCSFRC.all = 0x00; EPwm2Regs.DBCTL.all = 0x0007; EPwm2Regs.AQCTLA.all = 0x0090; EPwm2Regs.AQCTLB.all = 0x00; EPwm2Regs.AQCSFRC.all = 0x00; EPwm3Regs.DBCTL.all = 0x0007; EPwm3Regs.AQCTLA.all = 0x0090; EPwm3Regs.AQCTLB.all = 0x00; EPwm3Regs.AQCSFRC.all = 0x00; break; default: //同步机初始位置角检测初始化寄存器 EPwm1Regs.AQCSFRC.all = 0x0A; //CSFB=2--EPWM1B=1 CSFA=2--EPWM1A=1 EPwm1Regs.DBCTL.all = 0; EPwm1Regs.AQCTLA.all = 0x000C; //PRD---Toggle EPWM1A EPwm1Regs.AQCTLB.all = 0x000C; //PRD---Toggle EPWM1B EPwm2Regs.AQCSFRC.all = 0x0A; EPwm2Regs.DBCTL.all = 0; EPwm2Regs.AQCTLA.all = 0x000C; EPwm2Regs.AQCTLB.all = 0x000C; EPwm3Regs.AQCSFRC.all = 0x0A; EPwm3Regs.DBCTL.all = 0; EPwm3Regs.AQCTLA.all = 0x000C; EPwm3Regs.AQCTLB.all = 0x000C; break; } EDIS; } |
|
相关推荐
2个回答
|
|
|
|
还没有解决的话,可以加我微信:xmclby ***
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
647 浏览 0 评论
1926 浏览 1 评论
【⌈嵌入式机电一体化系统设计与实现⌋阅读体验】+磁力输送机系统设计的创新与挑战
1669 浏览 0 评论
3752 浏览 2 评论
5300 浏览 6 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-28 10:56 , Processed in 0.845732 second(s), Total 76, Slave 58 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号