Figure 4-15 rotation speed control – FUJITSU CAN-Motor Board MB91F267N User Manual
Page 79

AN07-00180-3E
- 79 -
The rotation speed routine is written around Line 166 in the MAIN.C main function as shown in “Figure
When the temperature sensor is used, the rotation speed is determined in the range of 0 to 100% by a
conversion according to the A/D value obtained from the temperature sensor and the upper limit. When
the programmed variables are used, the rotation speed is determined in the range of 0 to 100% by a
conversion according to the specified current and upper limit values.
Figure 4-15 Rotation speed control
void main(void)
{
(
omitted
)
/* main loop */
while (1)
{
if (!gCanEnableFlag)
{
/* Set motor turn speed */
if (gTempEnableFlag)
{
/* get an A/D channel */
ad = adGetValue();
ad = ad > TEMP_AD_VALUE_00 ? TEMP_AD_VALUE_00 : ad;
ad = ad < TEMP_AD_VALUE_09 ? TEMP_AD_VALUE_09 : ad;
/* calc motor turn speed */
gMtSpeedMax = TEMP_AD_VALUE_00 - TEMP_AD_VALUE_09;
gMtRevSpeed = gMtSpeedMax - (ad - TEMP_AD_VALUE_09);
(
omitted
)
}
else
{
gMtRevSpeed = 512;
gMtSpeedMax = 1024;
}
(
omitted
)
mtSetDuty(gMtRevSpeed,gMtSpeedMax);
}
(
omitted
)
}
}
←Calculation of the rotation
speed according to the
temperature sensor
←Calculation of the rotation speed according to
the programmed variables
←Speed setting