Two things to note though..
First, 'var' should have an '=' if you assign it a value, i.e.
The second is there's a stray ')' in the timer name.
For interest, I usually do loops the other direction, as it doesn't need to equate $chan(0) so often:
var %c = $chan(0)
while (%c) {
<code>
dec %c
}
Anyway