完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好,我驾驶一个带有DSPIC33 FJ64 GS606和A435快板驱动器的感应式无刷直流电机。我的问题是,电机完全按时钟方向转动,但是它变慢了,噪音变大了,而且当按逆时钟方向转动时,mosfet会变热。这里是:为了处理霍尔传感器,我在这个例程中使用了变更通知输入:这是驱动无刷直流的正确方式吗?我也尝试过开关盒程序,结果完全一样。提前谢谢你们的帮助。我完全不知道为什么这么小的变化,把马达转动搞得一塌糊涂。再见。
以上来自于百度翻译 以下为原文 Hello guys, I am driving a sensored BLDC with a DSPIC33FJ64GS606 and an A4935 Allegro driver. My problem is that the motor turns perfectly ClockWise but it is slower, noisier and the mosfet get hotter when it turns Counter ClockWise. To reverse the rotation, I basically use the exact same routine but backward. here it is : unsigned int HallValue = 0; void CW() // OK Work just fine { if (HallValue == 0) { IEC1bits.CNIE = 0; // turn off the Change Notification interrupt. PTCONbits.PTEN = 0; // turn Off the PWM Module IOCON1bits.OVRENH = 1; IOCON1bits.OVRENL = 1; // PWM OFF when OVRENx = 1 IOCON2bits.OVRENH = 1; IOCON2bits.OVRENL = 1; IOCON3bits.OVRENH = 1; IOCON3bits.OVRENL = 1; PTCONbits.PTEN = 1; // Turn On PWM Module IEC1bits.CNIE = 1; // Turn On Change Notification } else if (HallValue == 1) { IEC1bits.CNIE = 0; PTCONbits.PTEN = 0; IOCON1bits.OVRENH = 0; // PWM output not overrided so ON IOCON1bits.OVRENL = 1; // PWM Output Overrided so OFF IOCON2bits.OVRENH = 1; IOCON2bits.OVRENL = 1; IOCON3bits.OVRENH = 1; IOCON3bits.OVRENL = 0; PTCONbits.PTEN = 1; IEC1bits.CNIE = 1; } else if (HallValue == 2) { IEC1bits.CNIE = 0; PTCONbits.PTEN = 0; IOCON1bits.OVRENH = 1; IOCON1bits.OVRENL = 1; IOCON2bits.OVRENH = 1; IOCON2bits.OVRENL = 0; IOCON3bits.OVRENH = 0; IOCON3bits.OVRENL = 1; PTCONbits.PTEN = 1; IEC1bits.CNIE = 1; } else if (HallValue == 3) { IEC1bits.CNIE = 0; PTCONbits.PTEN = 0; IOCON1bits.OVRENH = 0; IOCON1bits.OVRENL = 1; IOCON2bits.OVRENH = 1; IOCON2bits.OVRENL = 0; IOCON3bits.OVRENH = 1; IOCON3bits.OVRENL = 1; PTCONbits.PTEN = 1; IEC1bits.CNIE = 1; } else if (HallValue == 4) { IEC1bits.CNIE = 0; PTCONbits.PTEN = 0; IOCON1bits.OVRENH = 1; IOCON1bits.OVRENL = 0; IOCON2bits.OVRENH = 0; IOCON2bits.OVRENL = 1; IOCON3bits.OVRENH = 1; IOCON3bits.OVRENL = 1; PTCONbits.PTEN = 1; IEC1bits.CNIE = 1; } else if (HallValue == 5) { IEC1bits.CNIE = 0; PTCONbits.PTEN = 0; IOCON1bits.OVRENH = 1; IOCON1bits.OVRENL = 1; IOCON2bits.OVRENH = 0; IOCON2bits.OVRENL = 1; IOCON3bits.OVRENH = 1; IOCON3bits.OVRENL = 0; PTCONbits.PTEN = 1; IEC1bits.CNIE = 1; } else if (HallValue == 6) { IEC1bits.CNIE = 0; PTCONbits.PTEN = 0; IOCON1bits.OVRENH = 1; IOCON1bits.OVRENL = 0; IOCON2bits.OVRENH = 1; IOCON2bits.OVRENL = 1; IOCON3bits.OVRENH = 0; IOCON3bits.OVRENL = 1; PTCONbits.PTEN = 1; IEC1bits.CNIE = 1; } else if (HallValue == 7) { IEC1bits.CNIE = 0; PTCONbits.PTEN = 0; IOCON1bits.OVRENH = 1; IOCON1bits.OVRENL = 0; IOCON2bits.OVRENH = 1; IOCON2bits.OVRENL = 1; IOCON3bits.OVRENH = 0; IOCON3bits.OVRENL = 1; PTCONbits.PTEN = 1; IEC1bits.CNIE = 1; } } void CCW() // NOK Noisier, slower and mosfets get hot. { if (HallValue == 7) { IEC1bits.CNIE = 0; PTCONbits.PTEN = 0; IOCON1bits.OVRENH = 1; IOCON1bits.OVRENL = 1; IOCON2bits.OVRENH = 1; IOCON2bits.OVRENL = 1; IOCON3bits.OVRENH = 1; IOCON3bits.OVRENL = 1; IOCON1bits.OVRENH = 1; IOCON1bits.OVRENL = 1; PTCONbits.PTEN = 1; IEC1bits.CNIE = 1; } else if (HallValue == 6) { IEC1bits.CNIE = 0; PTCONbits.PTEN = 0; IOCON1bits.OVRENH = 0; IOCON1bits.OVRENL = 1; IOCON2bits.OVRENH = 1; IOCON2bits.OVRENL = 1; IOCON3bits.OVRENH = 1; IOCON3bits.OVRENL = 0; PTCONbits.PTEN = 1; IEC1bits.CNIE = 1; } else if (HallValue == 5) { IEC1bits.CNIE = 0; PTCONbits.PTEN = 0; IOCON1bits.OVRENH = 1; IOCON1bits.OVRENL = 1; IOCON2bits.OVRENH = 1; IOCON2bits.OVRENL = 0; IOCON3bits.OVRENH = 0; IOCON3bits.OVRENL = 1; PTCONbits.PTEN = 1; IEC1bits.CNIE = 1; } else if (HallValue == 4) { IEC1bits.CNIE = 0; PTCONbits.PTEN = 0; IOCON1bits.OVRENH = 0; IOCON1bits.OVRENL = 1; IOCON2bits.OVRENH = 1; IOCON2bits.OVRENL = 0; IOCON3bits.OVRENH = 1; IOCON3bits.OVRENL = 1; PTCONbits.PTEN = 1; IEC1bits.CNIE = 1; } else if (HallValue == 3) { IEC1bits.CNIE = 0; PTCONbits.PTEN = 0; IOCON1bits.OVRENH = 1; IOCON1bits.OVRENL = 0; IOCON2bits.OVRENH = 0; IOCON2bits.OVRENL = 1; IOCON3bits.OVRENH = 1; IOCON3bits.OVRENL = 1; PTCONbits.PTEN = 1; IEC1bits.CNIE = 1; } else if (HallValue == 2) { IEC1bits.CNIE = 0; PTCONbits.PTEN = 0; IOCON1bits.OVRENH = 1; IOCON1bits.OVRENL = 1; IOCON2bits.OVRENH = 0; IOCON2bits.OVRENL = 1; IOCON3bits.OVRENH = 1; IOCON3bits.OVRENL = 0; PTCONbits.PTEN = 1; IEC1bits.CNIE = 1; } else if (HallValue == 1) { IEC1bits.CNIE = 0; PTCONbits.PTEN = 0; IOCON1bits.OVRENH = 1; IOCON1bits.OVRENL = 0; IOCON2bits.OVRENH = 1; IOCON2bits.OVRENL = 1; IOCON3bits.OVRENH = 0; IOCON3bits.OVRENL = 1; PTCONbits.PTEN = 1; IEC1bits.CNIE = 1; } else if (HallValue == 0) { IEC1bits.CNIE = 0; PTCONbits.PTEN = 0; IOCON1bits.OVRENH = 1; IOCON1bits.OVRENL = 0; IOCON2bits.OVRENH = 1; IOCON2bits.OVRENL = 1; IOCON3bits.OVRENH = 0; IOCON3bits.OVRENL = 1; PTCONbits.PTEN = 1; IEC1bits.CNIE = 1; } } To deal with the Hall Sensors, I use the Change Notification inputs with this routine : void __attribute__((__interrupt__, no_auto_psv)) _CNInterrupt(void) { IFS1bits.CNIF = 0; // clear flag HallValue = PORTB & 0x0038; // mask RB3,4 & 5 HallValue = HallValue >> 3; // shift right 3 times } Is that a decent way to drive a BLDC ? I tried with a Switch Case routine too with the exact same result. Thanks in advance for your help guys. I have absolutely no idea why such small change, mess up the motor rotation so badly. Bye |
|
相关推荐
7个回答
|
|
Hiven没有看过代码,但我想我可以给你指出一些可能性。电机运行速度变慢,噪音大,司机正在热身。这表示一个超时线圈接通其中一个相位。它和另一个相位“搏斗”,司机被强电流冲击而消散。无刷直流电机基本上是三相系统。为了反转旋转,你必须反转三相三角形,意思是交换两相。但是你也必须处理它的机械方面。例如,你的传感器定位。电机线圈的脉冲取决于此。如果传感器位置向前推进一点,它就会显示为反向滞后,反之亦然。你必须对这种差异进行调整。HIHA“开关/外壳”结构与“if/.if”结构没有区别。代码或逻辑,对于人类阅读来说比较简单。顺便说一句:一些明智的名称定义会奇迹般地低估你的代码在做什么。一个示意图也是不错的,但至少知道每个引脚连接到什么信号上。否则,它就是一团糟的“魔术数字”。奥迪可以理解。即使对你来说,生活也是如此艰难。
以上来自于百度翻译 以下为原文 Hi Haven't looked at the code, but I think I can point you some possibilities. The motor is running slower noisy and a driver is warming up. This points to an out of time coil switching on one of the phases. It "fights" the other 2 and the driver is hit by strong current surges that it dissipates in the form of heat. A BLDC motor is basically a 3 phase system. In order to reverse the rotation you have to invert the 3 phase triangle, meaning exchanging 2 phases. But you also have to deal with the mechanical aspects of it. For example your sensors positioning. The timing betwen the signals from the sensor(s) and the pulses to the motor coils depend on that. If the sensor position is a little advanced in forward, it will show up as retarded in reverse, and vice versa. You will have to make adjustments for this difference. HIH A "switch/case" construct is no different from an "if/else if" in terms of code or logic, its only simpler for human reading. BTW: A few defines with sensible names would do wonders in undersatnding what the heck your code is doing. A schematic would be nice too, but at least knowing what signal each pin is connected to.... Otherwise its all a mess of "magic numbers" that nobody can understand. Even for you life is harder this way. Best regards Jorge |
|
|
|
谢谢你的答复,乔治。的确,这完全有道理,因为马达不是颠簸的,只是噪音大一点,速度慢一点。我该怎么处理呢?关于如何解决这个问题,你有什么建议吗?
以上来自于百度翻译 以下为原文 Thanks for your answer Jorge. Indeed, it totally make sense since the motor isn't jerky but just a bit noisier and slower. how could I deal with this ? Do you have any hints on how to solve that ? |
|
|
|
嗨,我会用逻辑分析器或示波器来观察三相和传感器的脉冲序列。这些差别会立即显现。如果你没有访问这些工具中的任何一个,你必须从代码中画出一个方向的时序图和另一个方向的时序图,看看你能否挑选。与之不同的是,之后需要调整代码。
以上来自于百度翻译 以下为原文 Hi I would look at the pulse trains of the 3 phases and of the sensor with a logic analyser or oscilloscope. The differences would show up imediatly. If you don't have access any of those tools, you have to draw the timing diagram out of the code for one direction and the other and see if you can pick the differences from there. After that all it takes is to adjust the code. Best regards Jorge |
|
|
|
好主意!谢谢。我有一个示波器,所以明天我会静静地尝试。我会张贴一些更新,以防别人遇到同样的问题。
以上来自于百度翻译 以下为原文 Nice idea ! thanks. I have an oscilloscope so I'll try that tomorrow quietly. I'll post some updates in case someone else encounter the same problem. |
|
|
|
嗯,是的,显然是这样。(霍尔传感器没有完全对准)但是它从马达到另一个不同。当我调整代码时,它只适用于一个特定的马达,而不是另一个。所以,除非我找到了一种自动调整的方法,否则我会陷入困境。有人有想法吗?
以上来自于百度翻译 以下为原文 Well so yes apparenly it was that. (Hall sensors not perfectly aligned) but it vary from a motor to another. when I adjust the code, it will only work for a particular motor but not another one. So Im kinda screwed unless I find a way to automatically adjust that. Does someone have an idea ? |
|
|
|
|
|
|
|
是的。我打捞他们,但起初他们是双向驱动。
以上来自于百度翻译 以下为原文 yes they are. I salvaged them but initially they were driven both way. |
|
|
|
只有小组成员才能发言,加入小组>>
5250 浏览 9 评论
2037 浏览 8 评论
1958 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3219 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2266 浏览 5 评论
792浏览 1评论
682浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
615浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
686浏览 0评论
586浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-30 02:51 , Processed in 1.436790 second(s), Total 93, Slave 76 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号