This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

关于无刷直流电机例程BLDC3_1的问题,急求啊!



工程里面的文件F280XHALL3.C,有一段代码

if (p->EdgeDebounced==0)       // If motor has not moved then debounce current position. 
          {  
            F280X_HALL3_Debounce(p);
            p->CmtnTrigHall = p->EdgeDebounced;      // Set Commutation trigger here
          }
         else                                  // If current position is debounced, find match in table 
            F280X_HALL3_Next_State_Ptr(p);     // and return pointer to current state.  Ptr to be incremented
									           // by MOD6CNT after RET.	
 
         p->EdgeDebounced = 0;                // Reset trigger
     

因为else后面是没有花括号, p->EdgeDebounced = 0总是被执行,在退出if函数前,EdgeDebounced 都是会被清零的。但是p->EdgeDebounced这个变量唯一被赋值的地方就是这段代码中调用F280X_HALL3_Debounce(p)过程(整个工程搜过,没有其它地方赋值),所以说每次进入这个if (p->EdgeDebounced==0)判断,总是真的,那么 F280X_HALL3_Next_State_Ptr(p) 这个函数就永远无法执行了。

请问工程师,这是程序的错误,还是我的理解有问题,麻烦帮忙看一下,问了很久了,都没有工程师帮忙,求助啊!