February 14th, 2013, 12:55 PM
PWM in microchip C
Hi, I'm currently trying to control the speed of DC motors using PWM from PIC18F8722 using microchip C. I'm completely lost on this and could anyone explain how this can be done? If you could put an example program that would be much appreciated! The clock frequency is 10Mhz if that helps!
February 14th, 2013, 01:23 PM
February 14th, 2013, 03:19 PM
Thanks mate! But do you know where I can get details on the programming part of it?
February 15th, 2013, 02:41 AM
> Yesterday, 06:23 PM salem
> Yesterday, 08:19 PM Chuck123
Mmm, it took less than 2 hours for you to reply.
I wonder how long you actually took to hit the reply with your Pavlovian "feed me" response.
Because if you're too lazy to even manage to see "Brushed DC Motor Control Application Notes and Software" on the link I posted, let alone click on it and do some investigation for yourself, then programming is not for you and embedded programming definitely isn't for you.
February 15th, 2013, 10:21 AM
The answer to almost any question is already out there, and finding it is generally much more efficient and accurate than asking it.
In general for the "how do I program the XXX on processor YYY?" kind of question I would Google "YYY XXX application note", or even search Microchip's site directly (although Google is often better at indexing a site than the site itslef).
In this case:
"PIC18 PWM application note"
will get you exactly what you need.
Remember a few things:
- The greater the mark:space ratio the faster the motor will run.
- A brushed DC motor will have a distinct "dead-band" - a M:S ratio below which it will not move, and will just get warm.
- If the frequency is too low, it will be audible as a hum or whine when applied to the motor.
- A brushed motor is an inductive load, If the frequency is too high you will get little or no power.
- The higher the frequency the fewer "speed steps" are available.
- Do not connect the motor directly to the chip!