/*******************************************************************************
*
* Module: GetActualPositionEl()
*
* Description:
* The function returns actual electrical position.
*
* Returns: actual electrical position. -1 <= result <1 correspond to
* -PI <= result <= PI
*
* Global Data: None
*
* Arguments: None
*
* Defines:
* MOTOR_POLE_PAIRS - number of motor pole pairs
*
* Range Issues: None
*
* Special Issues: None
*
*******************************************************************************/
static Word16 GetActualPositionEl(void)
{
return(mpysu_asm( (ioctl(QTIMER_B1, QT_READ_COUNTER_REG, 0) * PULSES_THETA_COEF_SCALE_W16 * \
MOTOR_POLE_PAIRS), PULSES_THETA_COEF_UF16));
}
#define MOTOR_POLE_PAIRS 3 /* motor pole pairs */
#define PULSES_PER_REVOLUTION 1024/* number of encoder pulses per one revolution */
#define PULSES_THETA_COEF_SCALE_W16 (65536 / 4 / PULSES_PER_REVOLUTION)
#define PULSES_THETA_COEF_UF16 32768 * (65536.0 / 4.0 / PULSES_PER_REVOLUTION) / PULSES_THETA_COEF_SCALE_W16
这个是飞思卡尔DSP8346官方给的程序中用来确定转子位置的算法,求问这个具体的实现方法有人能受累解释一下么?特别是为什么要乘以32768 * (65536.0 / 4.0 / PULSES_PER_REVOLUTION) 这个数?谢谢大家了,没有多少金币,见谅啊 |