Generating PWM waves of desired frequency......

Friends first of all thanks for reading this question.....

 

Actually i need to generate a PWM signal of frequency near about 40 Hz with the help of Atmega 8 microcontroller ,it is easily done with the help of following program

 

void setup() {               
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(13, OUTPUT);    
}

void loop() {
  digitalWrite(13, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // set the LED off
  delay(1000);              // wait for a second
}

 

 

But i don't want to do it this way ,actually i want to do it by "analogwrite" function but analogwrite function directly doesn't allow us change the frequency of signal.I will be thankful if anyone can help me changing the frequecy of PWM signal....Need ur help frnds as soon as possible..

 

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

This reply was deleted.

Activity

Jose Araujo liked Jose Araujo's profile
Aug 29
spencer harvey liked spencer harvey's profile
Jul 9
More…