Generating sine wave from square wave discussion

timer Asked: Feb 18th, 2014

Question description

#include "mbed.h"
PwmOut PwmPin (p22);
int main() {

PwmPin.period(0.000005);  // Set frequency to 200,000 Hz (period = 5 us)
  while(1){ //infinite loop
  PwmPin.write(0);  // Set the duty cycle to 0%
  wait_us(500); // wait 100 PWM cyles
  PwmPin.write(1);  // Set the duty cycle to 100%
  wait_us(500);  // wait 100 PWM cycles

Hi I'm working on mbed LPC1768. I have generated 1kHz square wave from 200 kHz wave using PwmOut (pin22).

I need to convert that square wave into sine wave but i don't know how to do it.

Please help me.

Thank you


Tutor Answer

(Top Tutor) Studypool Tutor
School: University of Maryland
Studypool has helped 1,244,100 students
flag Report DMCA
Similar Questions
Hot Questions
Related Tags

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors