Hi,
I want to use AVR-USB but i also want to make use of a 16-bit timer.
When using the 16-bit timer the avr usb stops working and vice versa.
Is there any problem using a 16 bit timer togheter with AVR USB?
This is my timer code:
ISR(TIMER1_OVF_vect)
{
	PORTC=~PORTC; //Invert the Value of PORTC	
	timeCounter += 100;
}
void initTimer() {
	
	// Output Compare Register A = 18750 
	OCR1A = 18750;
	
	// Mode of operation: CTC, Prescaler = FCPU/64
	TCCR1B |= (1<<WGM12) | (1<<WGM12) | (1<<CS11) | (1<<CS10);   
	TIMSK1 |= (1<<OCIE1A);
	
	//Initialize Counter
	TCNT1=0;
	//Port C[3,2,1,0] as out put
	DDRC=0xFF;
	
	PORTC=~PORTC; //Invert the Value of PORTC
	
}
Thanks,
Nuno
			
			
									
									
						Doest AVR-USB uses timers?
Re: Doest AVR-USB uses timers?
No.
Exception: When you use the 12.8 MHz module and synchronize dynamically (very new firmware), Timer0 (8bit) is used.
This has nothing to do with timers (or any other built-in peripheral hardware) but with interrupt load.
Is USB not connected to PortC?
Does this ISR work fast enough (it looks like)?
You put a quite large integer to an 8-bit I/O register!
			
			
									
									
						Exception: When you use the 12.8 MHz module and synchronize dynamically (very new firmware), Timer0 (8bit) is used.
lpx wrote:I want to use AVR-USB but i also want to make use of a 16-bit timer.
When using the 16-bit timer the avr usb stops working and vice versa.
This has nothing to do with timers (or any other built-in peripheral hardware) but with interrupt load.
lpx wrote:ISR(TIMER1_OVF_vect)
{
PORTC=~PORTC; //Invert the Value of PORTC
timeCounter += 100;
}
Is USB not connected to PortC?
Does this ISR work fast enough (it looks like)?
lpx wrote:OCR1A = 18750;
You put a quite large integer to an 8-bit I/O register!
