Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Unable to generate 100Hz Fast PWM using ATmega8 Timer1

Status
Not open for further replies.

samEEEf

Full Member level 2
Joined
Apr 17, 2010
Messages
133
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Activity points
2,196
I need to generate 100Hz PWM from internal Clock (1Mz) of ATmega8. But unable to do. TOP value at ICR1 is not working. It generates constant frequency and I'm unable to change the frequency by changing TOP value. I can change the duty cycle by changing OCR1 value.

Here is the code

Code:
//Set OC1A on Compare Match, clear OC1A at BOTTOM, (inverting mode)
//Fast PWM mode , Pre scaler 1

int pwm16(void){

TCCR1A|=(1<<COM1A1)|(1<<COM1A0)|(1<<WGM11) ;
TCCR1B|=(1<<WGM12)|(1<<WGM13)|(1<<CS00);
ICR1=0x2710;
OCR1A=60;

return 0;
}

Could anybody help me on this regards...
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top