aliyesami
Full Member level 6
- Joined
- Jan 7, 2010
- Messages
- 369
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,296
- Location
- USA
- Activity points
- 4,190
I have generated a pwm signal from sample code/video available online and its working fine except its freq is only 76.4 Hz where as the meanwelll LDD driver I want to use requires 100-1Khz signal.
The code iam using is shown below.
I have two questions :
1- how can I increase the freq of this PWM signal to around 100+ Hhz ?
2- the datasheet is giving the formula to calculate the pwm freq but I cant get 76.5 Hz from it so if you can help me analyze why my freq is 76.Hz?
thanks
The code iam using is shown below.
I have two questions :
1- how can I increase the freq of this PWM signal to around 100+ Hhz ?
2- the datasheet is giving the formula to calculate the pwm freq but I cant get 76.5 Hz from it so if you can help me analyze why my freq is 76.Hz?
thanks
Code:
DDRB |= (1 << PORTB3); //PWM pin PINB3
TCCR0A = (1 << COM0A1) | (1 << WGM00) | (1 << WGM01);
TIMSK0 = (1 << TOIE0);
TCCR0B = (1 << CS00) | (1 << CS02);
Main {
ISR(TIMER0_OVF_vect)
{
OCR0A = 20;
}
.
.