Take an extra byte or word, and if the first counter makes an overflow than add 1 at that counter !
In the status register you can find the overflow.