小弟最近在看电机库,是利用定时器3捕获hall信号,但是看代码不是很明白,为什么计算电角度跟hall值1,2,4无关呢,只是判断3,5,6这几个hall值- bPrevHallState = bHallState;
- bHallState = ReadHallState();
- #if (HALL_SENSORS_PLACEMENT == DEGREES_120)
- switch(bHallState)
- {
- case STATE_5:
- if (bPrevHallState == STATE_5)
- {
- //a speed reversal occured
- if(bSpeed<0)
- {
- bSpeed = POSITIVE_SWAP;
- }
- else
- {
- bSpeed = NEGATIVE_SWAP;
- }
- }
- else if (bPrevHallState == STATE_6)
- {
- bSpeed = POSITIVE;
- }
- else if (bPrevHallState == STATE_3)
- {
- bSpeed = NEGATIVE;
- }
- // Update angle
- if(bSpeed<0)
- {
- hElectrical_Angle = (s16)(S16_PHASE_SHIFT+S16_60_PHASE_SHIFT);
- }
- else if(bSpeed!= ERROR)
- {
- hElectrical_Angle = S16_PHASE_SHIFT;
- }
- break;
复制代码 也不是很明白bSpeed 的作用,hElectrical_Angle 这个计算值是怎么出来的,有研究的坛友,希望指点一下。
|
评分
查看全部评分
卵你就知道,现在占20%出口额的电动车/扭扭车都是用霍尔+FOC方式!
https://www.stmcu.com.cn/Designresource/detail/LAT/710453