getting variable speeds from a d.c motor

#1
I am trying to be able to control the speed of a basic dc motor through an input on the pic 08m. I have created a circuit where the motor goes through a mosfet transistor (IRF630). I am using the following code to test if I can get different speeds out of the motor:

main:


for w0 = 0 to 100 step 1 'start a loop to ramp up pwm
pwmout 2,255,w0
pause 1000
next w0

for w1 = 100 to 0 step -1
pwmout 2,255,w1
pause 1000
next w1

goto main


Nothing seems to happen when I do this, where if I type "High 2" then the motor works.
Any suggestions?????
 
#3
Might be an idea to post your circuit, complete with component values.

I've never used that particular MOSFET but if you're using an unsuitable gate resistor, for example, you might not be driving it well enough to operate very fast and it might not be switching properly. That's just a thought based on not-a-lot of info.
 
#4
As intimated by Rick, pwmout 2,255,100 is not going to drive very hard and may not be enough to move the motor.
either, use pwmout 2,150,100
or pwmout 2,255,1023 for full power.

Once that is sorted, then you may possibly encounter the issue raised by Dippy.

Edited by - beaniebots on 22/08/2007 16:45:42
 
Top