Wafeeq
Member level 3
Hi All
i am working on Atmega16L. i want to run a machine whose speed varies with the frequency of PWM Signal. i am working on Codevison. please help me how to set the frequency of the pwn signal.. i have generated 800HZ with following code with 8MHz. i dont know how t change the frequency now. i want to change frequecy form 1Hz to 2KHz...
TCCR1A=0xA0;
TCCR1B=0x11;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x27;
ICR1L=0x10;
OCR1A=0;
//OCR1AL=0x00;
OCR1B=0;
//OCR1BL=0x00;
OCR1A=2500;// 50 % Duty cycle
OCR1B=2500;// 50 % Duty cycle
i am working on Atmega16L. i want to run a machine whose speed varies with the frequency of PWM Signal. i am working on Codevison. please help me how to set the frequency of the pwn signal.. i have generated 800HZ with following code with 8MHz. i dont know how t change the frequency now. i want to change frequecy form 1Hz to 2KHz...
TCCR1A=0xA0;
TCCR1B=0x11;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x27;
ICR1L=0x10;
OCR1A=0;
//OCR1AL=0x00;
OCR1B=0;
//OCR1BL=0x00;
OCR1A=2500;// 50 % Duty cycle
OCR1B=2500;// 50 % Duty cycle