8Mhz Signal From Arduino

So you might be thinking, Bullshit, you cannot get an 8mhz pwm signal out of an arduino. But you can. Ignoring the sine like shape of the waveform below for a minute, that is the actual PWM output from an arduino uno I was using to do this. So, why is it so.

Well, all you have to do is use some code wizardry using interrupts, timers and registers in such a way that the maximum pwm frequency you can get from most microcontrollers is 50% of the clock speed. Given that the arduino usually has a clock speed of 16mhz, this gives an actual maximum pwm out of 8mhz. And while this is nice, in practice it is not all that useful as the discrete numbers of frequencies that can be derived this way is not all that useful.

The code is below, I did not write this code and sorry to whomever did, I do not have a link back to it and your name was not included in the snippet, so i cannot credit you. Enjoy.

 

 

 

Facebooktwitterredditpinterestlinkedin

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.