PWM for motor speed control
Baldy
Posts: 3
I am new to Parallax products so have no previous knowledge of basic stamp·techniques let alone propeller ones! I think propeller would suit the application I have in mind which is to vary the speed of a motor using a fixed frequency PWM signal and varying·duty cycles, the speed·being determined by a varied analogue input voltage.·I know a lot of products would do that very easily but I want to alter the relationship between the input voltage and the output pulse in many ways and determined by other analogue inputs and switches. This relationship will need·floating point arithmatic.
Problem is I am stumbling at the first hurdle as I can't see the way to generate the PWM pulses I need, can anyone point me in the right direction please?
Problem is I am stumbling at the first hurdle as I can't see the way to generate the PWM pulses I need, can anyone point me in the right direction please?
Comments
dan
Now, having said that, it's possible to use a combined hardware/software approach with the counters' NCO mode and switching frequencies between the high and low output states. That way you can get nearly any combination of frequency and duty cycle you want — even current regulation via comparator feedback. But, so far as I can tell from the scant information I have, software intervention would be required.
-Phil
Thanks for the quick response, I did see both of those items. I don't know enough about BS2 to know if the object would do what I want, I will ckeck out the BS2 PWM command and see if it will work for me. It would be nice to try to code it myself but the biggest problem I have is that even though the reference says that the counters can be used for PWM it doesn't go into any detail about how to about it.
The pwm.spin object·has more horsepower than is strictly necessary for motor PWM.· While the test program specifies the duty cycles in·terms·of percent,·signal high and cycle times can actually be specified in terms of clock ticks.··A motor pwm object will likely appear that sends multiple PWM signals with a single cog (as opposed to the 1 pwm per cog that this one does).
<<<Note, the file that was attached to this post turned out to be an interim·archive that only worked up to a point.· The link now points to a file attached a couple posts down, and that·example program and object work as advertised>>>
Post Edited (Andy Lindsay (Parallax)) : 6/28/2006 9:50:03 PM GMT
Thanks, I will have a good look at those objects and try to get my head around it.
Sorry, that was an old version I posted.·
Attached is the one that works as advertized.
Post Edited (Andy Lindsay (Parallax)) : 6/28/2006 9:47:20 PM GMT