TI中文支持网
TI专业的中文技术问题搜集分享网站

位置基准生成 不太明白,大神能讲解一下吗?

// ============================================
// position reference generation test module
// ============================================
int32 posArray[8] = { _IQ(1.5), _IQ(-1.5), _IQ(2.5), _IQ(-2.5) },
ptrMax = 2, cntr1=0, ptr1=0, posSlewRate = _IQ(0.001);
int32 refPosGen(int32 out)
{
int32 in = posArray[ptr1];

out = ramper(in, out, posSlewRate);

if (in == out)
if (++cntr1 > 1000)
{
cntr1 = 0;
if (++ptr1 >= ptrMax)
ptr1 = 0;
}
return (out);
}

Susan Yang:请您看一下www.ti.com/…/sprabz0.pdf 的33页

The refPosGen() module basically cycles the position reference through a set of values as defined in an array ‘posArray’. These values represent the number of the rotations/ turns with respect to the initial alignment position. Once a certain position value as defined in the array is reached, it will pause for a while before slewing towards the next one. Therefore, these array values can be referred as parking positions. During transition from one parking position to the next, the rate of transition (or speed) is set by ‘posSlewRate’. The number of positions in ‘posArray’ to pass through before restarting from the first value is decided by ‘ptrMax’. Hence, add the variables “posArray”, “ptrMax” and “posSlewRate” to the expressions window.

// ============================================
// position reference generation test module
// ============================================
int32 posArray[8] = { _IQ(1.5), _IQ(-1.5), _IQ(2.5), _IQ(-2.5) },
ptrMax = 2, cntr1=0, ptr1=0, posSlewRate = _IQ(0.001);
int32 refPosGen(int32 out)
{
int32 in = posArray[ptr1];

out = ramper(in, out, posSlewRate);

if (in == out)
if (++cntr1 > 1000)
{
cntr1 = 0;
if (++ptr1 >= ptrMax)
ptr1 = 0;
}
return (out);
}

user1303469:

回复 Susan Yang:

int32 posArray[8] = { _IQ(1.5), _IQ(-1.5), _IQ(2.5), _IQ(-2.5) },      这个数组我是要电机运行 1.5转和者 2。5转。 但是实际却是 3转和5转。正好1倍,不知道怎么回事?

赞(0)
未经允许不得转载:TI中文支持网 » 位置基准生成 不太明白,大神能讲解一下吗?
分享到: 更多 (0)