Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
11 years, 4 months ago.
Distortion square wave
I am trying to generate a square wave with PWMOUT. But when i increase the frequency, the wave would have distortion. what causes this problem? And, if the frequency is over 50KHz, there's no wave coming out. Why? How can i get higher frequency, such as 50MHz.
1 Answer
11 years, 4 months ago.
I assume you are using the LPC1768. With default mbed libraries you should be able to get a signal up to 500kHz at 50% duty cycle. If you mean by distortion some overshoot for example, that isn't really a problem. If you are using a probe on your scope that can also create overshoot if it isn't properly compensated (should be a little screw on top of the probe connector).
With http://mbed.org/users/Sissors/code/FastPWM/ you can get PWM frequencies up to 48MHz at 50% duty cycle.
Thank you very much. Yeah, I'm using LPC1768. But why can I only get a signal up to 500KHz with default mbed libraries? And I also used FastPWM, which did increase the frequency. So what's the difference between the two libraries? For the distortion, I still don't know what cause this ? I meant that when the frequency was high, the waveform would change from sqaure to triangle almost. Thanks again. I'm a bigginer in this field.
posted by 08 Jul 2013If it went from square to something like sine/triangle, you probably have either a large capacitive load on it, or your measurement device simply isn't fast enough.
The reason it is 500kHz with default library is that it has 1us resolution. So 1us high, 1us low = 500kHz. The hardware can get up to resolution of a clock period. Clock runs at 96MHz, and FastPWM allows for that resolution. So then you got 1 clock cycle low, 1 clock cycle high = 48MHz.
posted by 08 Jul 2013
What are you using to view the square wave?
posted by Amador Valley High School Robotics Team 08 Jul 2013