PWM
G'day fellas.
Got a quick question. I want to control a 12V 120mm fan using a logic mosfet.
I'm reading temperature with a thermistor and RCTIME and controlling the mosfet using PWM.
Currently i have the mosfet connected via a current limiting resistor and a pull up to 5V on gate.
Whats the best way to 'clean' the PWM so the fan doesn't 'hunt' (pulses with the PWM duration)?
Cheers!
Got a quick question. I want to control a 12V 120mm fan using a logic mosfet.
I'm reading temperature with a thermistor and RCTIME and controlling the mosfet using PWM.
Currently i have the mosfet connected via a current limiting resistor and a pull up to 5V on gate.
Whats the best way to 'clean' the PWM so the fan doesn't 'hunt' (pulses with the PWM duration)?
Cheers!
Comments
I don't understand what you mean by cleaning the PWM so the fan doesn't hunt. Also, what are you doing with the fan? Are you trying to maintain a temperature by cooling (or not) with the fan? What are you cooling? Is the temperature reading device in the airstream? If so, it will be cooled off, giving erroneous readings.
Thanks,
PeterM
The 'hunt' is when the program is doing other things, not PWM.
Is there a way i can run a PWM in the background while the program is looping. I don't know how to use interrupts, i guess i will need to learn?
Thanks for any help!
Interrupts are your friend. BTW, are you programming in assembly or SX/B ? I think that SX/B can do PWM in the background for you, but I wouldn't swear to it. I'm an assembly programmer by nature, so I haven't really used SX/B.
Thanks,
PeterM
Time to hit the books, thanks for your help PJMonty!
Which SX chip are you using? SX/B can use the built in timers on the SX chip. I've been using the SX48 which has two built-in 16-bit timers. I think the SX28 has a single 8-bit timer but I haven't used that one in any projects yet. The timers can run in the background since they are built into the hardware while you do other stuff. You need to use specific pins for each timer so check the datasheet to get the proper connections for which chip you are using.
For the SX48 using timer 1 (PIN RB.6)
TIMER1 PWM, Spd, Duty
The value you select for the duty cycle will depend on the clock speed you're using.
Hope this helps,
Robert
JonnyMac- I'll have a go at dissecting your program, i think your ideas will help me. Thanks!
Post Edited (jokerswild) : 9/28/2007 12:23:59 AM GMT
LOW_SPEED:
· PWM RC.0, 64, 50
This caused the led in my SX28 test circuit to pulse. Then went back to the way I coded it when I was using a BS2.
LOW_SPEED:
·PWM RC.0, 64, 50
··GOTO Start
This brought back a steady light that varied bright to dim with the different PWM commands.