Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] Timer1 error

2007-11-23 by David Kelly

On Nov 21, 2007, at 1:21 PM, twrokspit wrote:

> I have an error reading the TCNT1L, TCNT1H from the 16-bit counter, im
> using the ICP1 and when this causes an interruption the High and Low
> bits of the counter must be read.
>
> When i try to assemble the project i got i message which says
>
> operand 2 out of range and gives me the address of the counter  
> registers
>
> in r6,TCNT1L
> in r7,TCNT1H


The input capture hardware is supposed to do that job for you. It  
*captures* the timer value when the ICP1 pin changes. A copy of TCNT1  
at the instant of ICP1 should be in ICR1 depending on how you  
configured the input capture system. You could then subtract ICR1 from  
TCNT1 to determine how long ago the event happened.

--
David Kelly N4HHE, dkelly@HiWAAY.net
========================================================================
Whom computers would destroy, they must first drive mad.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.