I think I have settled on the 12F683. It has an 8mhz internal osc, A/D converter and hardware PWM so it doesn't have to be constantly strobed.
Also the 2k words program memory is a nice touch. I can be as sloppy with my code as I want and still have room to spare.
Getting closer..Anything below 90deg fan is off so:
If Temp<90 then HPWM=0
Then at 90 deg fan comes on at 50%:
If Temp=90 then HPWM=127 (50% of 255 leaving 127 remainder). 'Minimum fan speed
Here is the part I don't understand. From 91 to 120 the fan speed needs to vary according to temperature so:
From 91 to 120 each degree needs to widen the HPWM by 4.23 (remaining 127 / 30 deg) speeding up the fan incrementally by temp.
Finally
IF Temp>= 120 then HPWM=255 'Full fan speed at or above 120 deg
The actual PBP command is: HPWM Channel,Dutycycle,Frequency
so at 90 deg on channel 1, 50% duty cycle and 1khz rate the command
would be HPWM 1,127,1000. I can replace the 127 with a variable.
Bookmarks