How to obtain four PWM outputs at 100 kHz using an arduino uno board? The requirement is that all four PWM outputs should have controllable duty ratios individually.
migrated from electronics.stackexchange.com Mar 28 at 15:20This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts. |
|||||||||
|
You can't squeeze 100kHz out of an Arduino without a major software rewrite (at which point you will be using an AtMega chip rather than Arduino). You can achieve 100kHz PWM by toggling pins manually and busy-waiting, but you won't be able to do anything else during this. Or you can make use of interrupts, which is a big leap from Arduino ecosystem as I already said. |
|||||||||||||
|
In a comment to Dmitry Grigoryev’s answer you wrote:
It seems you already have the solution to your problem: that's exactly the way to do it! Well, there is a catch: since you are using But there is a solution. Timer 1 has a feature the other timers
don't have: you can define its period using using the input capture
register Some caveats:
|
|||||
|
use |
|||||
|
... edit: here is an example of how approach 1) above can be done. two 100Khz pulse trains at 10% dc and 50% dc, independently configurable. zero overhead and all within the confines of arduino. |
|||||||||
|