Re: The 6522 VIA serial shift register bug

From: Pasi Ojala (albert_at_cs.tut.fi)
Date: 2006-05-11 22:10:37

> Since a complete disk rotation roughly needs 200000 clock 
> cycles, but one 16-bit timer is only able to do 65536 counts

Just a thought:
Why not just calculate an average number of cycles it should take,
then assume that the counter has wrapped two or three times.

If we take 200000 to be the expected number, then values
3392 to 36160 means wrapped 3 times (200000-65536*3 = 3392)
and are above 200000, 0 to 3392 means also wrapped 3 times
and are below 200000, 36161 to 65535 means wrapped 2 times
and below 200000.

Well, the timer does count down, right? So reverse the arithmetic,
but you get the idea..

The rotation speed can not be off by +-32768/200000 = 16%,
or can it?

-Pasi
-- 
/He had no choice but to leave Juilin alone. Whoever the woman was, she
 might get the thief-catcher beheaded yet, but that sort of fever had
 to burn itself out before a man could think straight. Women did strange
 things to a man's head./  -- Mat in The Wheel of Time:"Winter's Heart"

       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail pre-2.1.8.