A86: Re: Countdown?


[Prev][Next][Index][Thread]

A86: Re: Countdown?




Easiest way would be to use the interrupt.  Remember, it runs ~200 times a
second.  Probably closer to 180 (176?), but varies with the battery
strength.  Try something like this:

 ld c,5
Loop:
 ld b,180
Delay:
 halt       ; wait for interrupt
 djnz Delay
 ld a,c
 add a,'0'
 call _putc
 call _newline
 dec c
 jr nz,Loop

This will count from 5 to 1 and display the number on a new line every
second.




>
> Hi all,
>
> I am looking for a way to count down from 5 seconds to 0 seconds.  (Yes,
> I know time is not precise; close enough is good enough.)  Any thoughts
> on this?  Email responses would be appreciated, as I receive this list in
> digest form.
>
> Kevin DeGraaf




References: