ISR(TIMER1_COMPA_vect)

I am learning C and have the following problem:

I want to use timer interrupt routine. The routine works, the LED switch ON and OFF. In side of the routine I want decrement a counter. The routine is below:

(I declare the count variable as "volatile uint16_t count=0;").

ISR(TIMER1_COMPA_vect)          // timer compare interrupt service routine
{
  
  digitalWrite(ledPin, digitalRead(ledPin) ^ 1);   // toggle LED pin
  count--;
   if (count=0)
  {
    TCCR1B =0;
  }  
}

I want decrement a counter (count) and stop the timer when it reaches zero, but, the counter doesn't decrement.

Can you please help on solving this problem?

Thanks, Manuel

 if (count=0)

To compare you need to use ==, like this:

 if (count == 0)

[quote author=Manuel Silva link=topic=76185.msg575368#msg575368 date=1319154348]

   if (count=0)

[/quote]

Ahhh, thanks for this. :)

I have some fun memories from a friend of mine that never managed to get this right. And he knew how to program, and yet never came to memorize the difference between "=" and "==". LOLOL

Thanks for your help. It was really a crazy question. It was lat in the night, so, I may was sleeping.

regards, Manuel