Go Down

Topic: Generating PWM from PID to control DC motor (Read 5551 times) previous topic - next topic


If you do the modulation in a software loop like that your code cannot do anything else, such as
run the PID algorithm.

Answer #5 guides to how to set the frequency, and more control of the PWM units.  That's definitely
how to do this.  The hardware generates the PWM, the software regularly updates the duty cycle
(and even frequency if that's needed) from the PID output.  The software has a high-level role, the
hardware does the grunt work.
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]


Sir i didnt find pwmGenerate() in arduino website
Of course you didn't. It does not exist. I just said that it might have been a more meaningful name for the function that is now called analogWrite().

Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up