Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • I don't understand what you want to achieve. Pulse width of 1000ms at a sample rate of 488.28Hz that seems contradictory, as the maximum pulse width can only be 2ms at 488Hz. Commented Oct 7, 2014 at 12:26
  • 2048 to be exact for this case. Why is that contradictory, if I want to have pulses between 1 and 2 ms (something around 48% and 97% duty cycle)? Commented Oct 7, 2014 at 12:39
  • That doesn't really make it any clearer. Seems I can't help you then. Commented Oct 7, 2014 at 14:36
  • I'm not 100% familiar with Arduino timers, but here is how I did PWM on an MSP430 with timers: imgur.com/2aOnW2g Essentially, you count up, and reset. When the timer hits the set value, it does the rising edge pulse, and when it hits the max count, it resets both the pulse and the timer. The alternative of this is to do the opposite: set the pulse high until the timer hits the threshold value, etc. Commented Oct 10, 2014 at 12:19
  • Thanks. What you suggest is in Atmels Documentation called fast PWM, where the counters just count until overflow. I however use phase-corrected PWM, where it counts up and down. This gives a more symmetrical output (and according to them) is prefered over fast PWM. Commented Oct 10, 2014 at 14:04