Timer/Counter in ATmega128

Hello everybody again! I’ve already solved the little trouble of hte last time but now I got a new one: I’m trying to access the Timer/Counter0 but I can’t make it count automatically: in fact I suppose it should be possible to set some parameters in certain register and then the counter should begin to count, but it’s not working in the way I expect…

Could anyone PLEASE help me and explain me which registers I have to set to make the counter work in the right way?

PLEASEEEE… :slight_smile:

Thanks to everybody!

Here is how I initialize the timer:

in r16,ASSR

ori r16,(1<<AS0) ; enable async timer mode

out ASSR,r16

clr r16

out TCNT0,r16 ; reset timer at zero

ldi r16,1

out TCCR0,r16 ; normal timer output, use divide/1

wait: in r16,ASSR ; wait for timer updates to clear

andi r16,7

brne wait

Thanks a million man!

I had already found the right settings on the configuration registers!

You have been very nice!

See you soon!