Please i need your help and support in correcting this code. I am using attiny861 to generate a
PWM Signal of 200Hz.The codes below are what i wrote to generate the signal
but when i checked the frequency of the signal on the oscilloscope,I got 7.396kHz instead of 200Hz.
According to the datasheet the PWM Frequency is calcualted with this equation:
PWM(freq.) = Fclk/N where N is the TOP value.My microcontroller is
running @ 1MHz.
I would be glad if somebody could put me through on how to get the desired frequency.Thank you for the usual support.Best regards.
Code:
#include
#include
#include
#include "NewHeaven_LCD.h"
int main( void )
{
int LED_Power=1;
int On_Time=0;
// Set PWM-Port PB4
PORTB = 0x00;
DDRB |=(1
PWM Signal of 200Hz.The codes below are what i wrote to generate the signal
but when i checked the frequency of the signal on the oscilloscope,I got 7.396kHz instead of 200Hz.
According to the datasheet the PWM Frequency is calcualted with this equation:
PWM(freq.) = Fclk/N where N is the TOP value.My microcontroller is
running @ 1MHz.
I would be glad if somebody could put me through on how to get the desired frequency.Thank you for the usual support.Best regards.
Code:
#include
#include
#include
#include "NewHeaven_LCD.h"
int main( void )
{
int LED_Power=1;
int On_Time=0;
// Set PWM-Port PB4
PORTB = 0x00;
DDRB |=(1