Getting value from TCNT0 AVR

825 views Asked by At

I have a timer which increments by one every 256 cycles. Is there a way that i can get the value from TCNT0 at the point it is called.

I am using AVR Studio 4 and have tried using ldi temp, TCNT0 but i always seem to get 32 which is its address.

Thanks

1

There are 1 answers

0
Ignacio Vazquez-Abrams On BEST ANSWER

If TCNT0 is within I/O space then you can use IN to retrieve its value, otherwise you will need to use LDS to load it from its memory address (which is usually offset by 0x20 from the I/O register location).

in tmp,TCNT0