# AN1078 DELTA_STARTUP_RAMP calculate problem

Hi, all friends:

i can't understand why DELTA_STARTUP_RAMP should multiplication 65536 two times.

#define OPENLOOPTIMEINSEC 3.0 // Open loop time in seconds.

#define LOOPTIMEINSEC (1.0/PWMFREQUENCY) // PWM Period = 1.0 / PWMFREQUENCY

#define DELTA_STARTUP_RAMP (unsigned int)(MINSPEEDINRPM*POLEPAIRS*LOOPTIMEINSEC* \

LOOPTIMEINSEC*65536*65536/(60*OPENLOOPTIMEINSEC))

if(uGF.bit.OpenLoop)

{

if (Startup_Lock < MotorParm.LockTime)

Startup_Lock += 1; // This variable is incremented until

else if (Startup_Ramp < MotorParm.EndSpeed)

Startup_Ramp += DELTA_STARTUP_RAMP;

else{

....

}

ParkParm.qAngle += (int)(Startup_Ramp >> 16);

}

i think it used for float to Q15 convertion， but multiplication 65536 two times ， equal to << 32bit

and the qAngle I think is Q15 format, i know float to Q15 should multiplication 32768, 2^15,

so i think ParkParm.qAngle += (int)(Startup_Ramp >> 17); is right, because <<32 , then >> 17 , equal to << 15.

right????? so what's the correct understanding for multiplication 65536 two times.

thank you for your reply!