AVR, timer, gcc

Rosko, Peter Peter.Rosko@siemens.com
Úterý Leden 24 12:47:38 CET 2006


Zdravim,

mam atmega8,

chcem v rutine externeho prerusenia zapnut timer2, ciel je po jeho
expiracii nieco spravit.
stale, stale, stale mi to vsak nastartuje timer2 rutinu hned po tom, ako
skoncim s externym prerusenim rutinou

inicializacia
TCCR2 = _BV(CS22);

PORTD = 0xff;
	
//Interrupt 1 sensitive for any logical change
MCUCR = _BV(ISC10);
	
//Enable External Interrupt 1
GICR = _BV(INT1);





externa rutina
SIGNAL(SIG_INTERRUPT1)
{	
	if (PIND & _BV(PD3)) //0->1
	{
		code[code_counter++] = TCNT2;
	}
	else //1->0
	{
		TCNT2 = 1;	
		TIMSK |= _BV(TOIE2);
		TIFR |= _BV(TOV2);
	}	
	
}

SIGNAL(SIG_OVERFLOW2)
{
...tu by sa malo spracovat co mam ulozene v code[]
}


preco sa kua kua timer2overflow spusta hned ?
vdaka za napady, predpokladam ze cosi citam v ds zle ale uz ma to sameho
nebavi :(

vdaka, p.rosko



Další informace o konferenci Hw-list