A method for controlling the rotating speed of a fan is disclosed. The
method includes the steps of: reading a standard temperature T.sub.c of a
central processing unit (CPU); reading a thermal diode's temperature
T.sub.d and a system ambient temperature T.sub.a; comparing T.sub.d with
a minimum temperature T.sub.l, such that the fan begins processing the
heat of the CPU begins; if T.sub.d>T.sub.l, increasing pulse-width
modulation (PWM) duty cycle of the fan to 100%; if T.sub.d<=T.sub.l,
comparing a critical temperature T.sub.0 with T.sub.a; if
T.sub.a>T.sub.0, increasing PWM fan duty cycle to 100%; if
T.sub.a<=T.sub.0, setting the fan duty cycle at 40%; sending the PWM
fan duty cycle to a fan speed controller.