[net.micro.cbm] time inaccurate on VIC

km@emory.UUCP (Ken Mandelberg) (09/23/84)

I find that the clock on my VIC20 runs about 1.5 seconds
fast per hour. Since I use it as a dedicated controller 
for my VCR, the time drift is a real problem. 

First, I wonder if the inaccuracy is characteristic in VICS, and if 
so is it by the same amount in each.

My first reaction was to compensate for the drift in my
program. Unfortunately, the program eats up all of the 3800
bytes, and for time correction to get in something else has
to go out.

Does anyone have a simple fix for tuning the clock?


Ken Mandelberg
Emory University
Dept of Math and CS
Atlanta, Ga 30322

{akgua,sb1,gatech}!emory!km   USENET
km@emory                      CSNET
km.emory@csnet-relay          ARPANET

joels@tektronix.UUCP (Joel Swank) (09/27/84)

()
    I also have used VICs for dedicated control applications. I found that
they all have inaccurate clocks. Some run fast and some run slow. Each one
is different. I wrote some automatic corrrection code into my program. I 
found that even the ammount of error varied over time on the same machine.
I have to set the time at least once a week to maintain accuracy to within
a couple of minutes. I'm afraid that if you need extreme accuracy over
a long period of time, the only answer will be a hardware clock.

Joel Swank
Tektronix, Beaverton OR

joels@tektronix.UUCP (09/27/84)

References: <1401@emory.UUCP>
Relay-Version:version B 2.10.1 6/24/83; site ncsu.UUCP
Posting-Version:version B 2.10.1 (Tek) 9/26/83; site tektronix.UUCP
Path:ncsu!mcnc!decvax!tektronix!joels
Message-ID:<3718@tektronix.UUCP>
Date:Thu, 27-Sep-84 12:12:30 EDT
Organization:Tektronix, Beaverton OR

()
    I also have used VICs for dedicated control applications. I found that
they all have inaccurate clocks. Some run fast and some run slow. Each one
is different. I wrote some automatic corrrection code into my program. I
found that even the ammount of error varied over time on the same machine.
I have to set the time at least once a week to maintain accuracy to within
a couple of minutes. I'm afraid that if you need extreme accuracy over
a long period of time, the only answer will be a hardware clock.

Joel Swank
Tektronix, Beaverton OR

blk@syteka.UUCP (Brian L. Kahn) (09/28/84)

I'm not sure how the VIC works, but if it is like the 64 (bet it is!)
the 'clock' accessible from basic is not really a clock at all, but
a counter that shows how many interrupts have elapsed.  This roughly
approximates a clock.  The 64 uses a Versatile Interface Adapter (VIA)
to read the keyboard, as did the old pet.  This chip has a hardware
clock hidden in it that can be reached with some peek/pokes.  The
VIC likely has one, too.

B<

doug@terak.UUCP (10/15/84)

[]

If you get ahold of one of the manuals which lists the page
zero memory usage in the VIC, I'm pretty sure you will find
a pair of locations which contains the clock speed used for
the 2622 VIA.  This value is such that:
                                system clock (about 1 million)
ticks_per_second (about 60) =  ---------------------------
                                (LOC+1)*256 + (LOC)

By adjusting the contents of those locations via POKEs, you
should be able to adjust the clock speed.  Use smaller values
for faster, larger values for slower.

I can't guarantee that these locations exist, but I'd give
you 10-to-1 odds on it.  They could be in ROM, where you can't
change them even if you find them -- you might try changing
the VIA directly in that case.

Good Luck!
    Doug Pardee -- Terak Corp. -- ...!noao!terak!doug