Sign In

Problem In Toggling Square Pulses With Specific Values Of OCR1A

Rahul1234 rajesh190295@gmail.com

Hardware: ATmega16 Microcontroller With 8MHz Software: C Project Using ATMEL STUDIO 7

In the Program im trying to toggle the pulses with specific value of OCR1A using the
PORTB ^= (1 << 0) ;

But how to toggle the output using the bits
COM1A1/COM1B1 and COM1A0/COM1B0 from TCCR1A register

Images

Program

#include <avr/io.h>
int main ( void )
{
    DDRB |= (1 << 0) ;
    TCCR1B |= (1 << WGM12);
    TCCR1A |= (1<<COM1A0);
    OCR1A = 625;
    TCCR1B |= ((1 << CS12));
    for (;;)
	{
	   if ( TIFR & (1 << OCF1A))
		{
		  PORTB ^= (1 << 0);
		  TIFR = (1 << OCF1A);
		}
	}
}

Post a reply to Rahul1234

Think you can help Rahul1234 ? Then post your thoughts that might help Rahul1234. You will earn a lot of reputation in the technical community.

If your program is in multiple files, then ZIP the entire folder and attach below

Images and Screenshots

These helps other better understand your suggestion.