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.

2812 BLDC

老师:

您好!菜鸟最近在学习无刷直流BLDC电机BLDC3-1文档与例程.其中电机驱动库中有hall3_drv模块,此模块目的是根据检测到hall信号决定电机换相信号,其中有一个变量为Stallcount  不知道怎么回事?而且计数那么多次,恳请不吝赐教,感谢您百忙之中的回复!下面附上程序:

void F281X_EV1_HALL3_Debounce(HALL3 *p)
{

   if (p->HallGpio == p->HallGpioAccepted)   // GPIO_UNCHANGED: 没变Current GPIO reading == debounced GPIO reading?
   {
      if (p->Revolutions <= 0)         // Only create hall map during initial Revolutions
         F281X_EV1_HALL3_Create_Map(p);
      p->StallCount -= 1;            // Decrement stall counter
      if (p->StallCount == 0)
       { 
         p->EdgeDebounced = 0x7FFF;     // If motor has stalled, then user trigger to commutate
         p->StallCount = 0xFFFF;    // Reset counter to starting value
       }
   }
   else          // GPIO_CHANGED: If not zero, then the motor has moved to a new position.
   {
      if (p->HallGpio == p->HallGpioBuffer)  // Current GPIO reading == previous GPIO reading?
      {
        if (p->DebounceCount >= p->DebounceAmount)  // If equal, is current GPIO reading debounced?
        {
          p->HallGpioAccepted = p->HallGpioBuffer;  // Current GPIO reading is now debounced,当前位置已经去抖
          p->EdgeDebounced = 0x7FFF;        // Edge/position debounced, trigger commutation

          p->DebounceCount = 0;             // Reset debounce counter

          if (p->HallMapPointer==0)
             p->Revolutions += 1;          // Increment on every rev (HallMapPointer = 0)
        }
        else     // DEBOUNCE_MORE
          p->DebounceCount += 1;            // Increment debounce counter
      }
      else       // NEW_READING
      {  
         p->HallGpioBuffer = p->HallGpio;  // Save new reading and reset debounce counter
         p->DebounceCount = 0;
      }
   }
}