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.

TMS320F28069M: On a function in lab11e in F28069M

Part Number: TMS320F28069M
gHall_State_delta = gHall_PwmIndex[gHall_State] - gHall_PwmIndex[gHall_PrevState];
  if((gHall_State_delta == -1) || (gHall_State_delta == 5))
  {
   gHall_dir = 1;   // positive direction
  }
     else if((gHall_State_delta == 1) || (gHall_State_delta == -5))
  {
   gHall_dir = 2;   // negative direction
   gHall_speed_fdb_pu = -gHall_speed_fdb_pu;
  }
  else
  {
   gHall_dir = 0;   // direction change
  }
How did you get it in this paragraph (gHall_State_delta =-1) / (gHall_State_delta = 5),-1 and 5?
More urgent, know the great god please tell me, thank you!
  • As you can see the code in HALLBLDC_State_Check(), read the state of the GPIOs of the hall signal, and get the current and previous commutation state of PWM according to the index array of the PWM state, and then calculate the difference value of the current and previous state. The PWM index array is defined by the hall signals and the connection of the motor.

  • Thank you for your answer!

    According to this program, can the motor reverse be realized? How to achieve it?

    If the reference value of the velocity is changed to a negative value, the overcurrent occurs, but the positive rotation is normal.

  • As replied to you, you only need to set the positive/negative value to the reference speed for clockwise and anti-clockwise rotation without any change if the clockwise rotation is fine.