Generating sine wave from square wave discussion

Sigchi4life
Category:
Programming
Price: $5 USD

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

Ravneet

Tutor Answer

(Top Tutor) Daniel C.
(997)
School: New York University
PREMIUM TUTOR
Studypool has helped 1,244,100 students
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1828 tutors are online

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