Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Excact Vertical Frequency / Refresh Rate
2017-07-18 21:22
TWW

Registered: Jul 2009
Posts: 541
Excact Vertical Frequency / Refresh Rate

I am making a clock by using a CIA timer. Basically I calculate how many cycles are executed each second by calculating lines x cycles/line x vertical refresh rate.

I then want to make the clock run correct on all systems (NTSC/PAL/DREAN/NTSC_Old) and in this context, I was wondering what is the EXACT vertical refresh rates for these systems (50 and 60 plus 3 decimals or more)?

(I've found conflicting information around the web so that's why I'm asking)
 
... 20 posts hidden. Click here to view all posts....
 
2017-07-19 19:45
Stryyker

Registered: Dec 2001
Posts: 465
TOD does not use the kernal.
2017-07-19 20:39
chatGPZ

Registered: Dec 2001
Posts: 11108
more relevant: to make an actual clock - use the CIA TOD, it has excellent long term stability (more than the system clock). CIA timer is useful only for short-time measurements.
2017-07-19 22:37
TWW

Registered: Jul 2009
Posts: 541
Ah yeah, I mixed up TOD with the KERNAL TI... Totally forgot about it.

I chained two timers on CIA #2 to trigger a NMI which incremented the second counter. Guess I could just as easily use the TOD.

Just to confirm, is the TOD correct on all systems (PAL/NTSC/DREAN)?
2017-07-19 23:01
chatGPZ

Registered: Dec 2001
Posts: 11108
the TOD uses the power grid frequency - so you need to set it up according to that. if you want it to be 100% correct always, you need to measure the power grid frequency first, then set up the TODs 50/60Hz bit correctly. see this test program for inspiration: https://sourceforge.net/p/vice-emu/code/HEAD/tree/testprogs/CIA.. - you cant rely on the video system because eg on the SX64 its always 60Hz.
2017-07-20 09:44
Style

Registered: Jun 2004
Posts: 498
I wouldnt use the power frequency (and thus the TOD) for anything that requires any accuracy at all.

Power grids are notoriously bad in terms of frequency.
2017-07-20 12:31
chatGPZ

Registered: Dec 2001
Posts: 11108
ehrm, no they are not. please read up on the topic. they are putting a lot of effort into keeping all grids in sync and keeping the frequency stable.

edit: to make it clear.... shorttime this is correct, the frequency may drift up and down quite a bit, sth like +/- 1% or so at max (it usually does so during the day - you can use the mentioned test program to examine this). however, the number of periods for long time periods (a weeek, a month... i dont remember what is guaranteed) is very accurate, and certainly ok to use for a wall clock.
2017-07-20 19:01
soci

Registered: Sep 2003
Posts: 473
Not all C64s are running on the original brick any more. Some replacements use an inverter or are DC only except those with a small 9V transformer bolted on the side.

I didn't bothered to do an inverter and just installed a 555 next to the CIA and hand tuned it to ~50 Hz or so to keep the TOD running. Wondering how much ppm can it be ;)

Also the pre-scaler can't be reset so starting it accurately is problematic.

Therefore I rarely use the TOD and go with the timers instead, those always work.

Btw. is it possible to make a centisecond longer by switching it from 60 to 50 Hz pre-scaling at the right time?
2017-07-20 19:12
chatGPZ

Registered: Dec 2001
Posts: 11108
if you are running the C64 with some half-broken PSU... yeah no guarantees then =P

trying to confuse the centiseconds counter like you said SHOULD work imho ... kinda like opening the borders =) it should count to $f then and wrap around. make a test program and have a look (it will break on every emulator right now, i guess ....)
2017-07-20 19:29
Compyx

Registered: Jan 2005
Posts: 631
What about using NTP via RRNet? Sounds fun to do.
2017-07-20 20:53
soci

Registered: Sep 2003
Posts: 473
I thought about that too.

But it'd be more fun to connect a RS232 GPS time receiver to the user port at 9.6 kbit/s with it's PPS output on CNT input of CIA.

Once synchronized it stays so without further effort ;) The NTP synchronization on the other hand needs to be repeated to compensate for any drift.
Previous - 1 | 2 | 3 | 4 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
csabanw
megasoftargentina
Quetzal/Chrome
Thunder.Bird/HF/MYD!..
iceout/Avatar/HF
Guests online: 130
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 The Ghost  (9.6)
9 Wonderland XIV  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.8)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Onscreen 5k  (9.5)
8 Wafer Demo  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Swappers
1 Derbyshire Ram  (10)
2 Jerry  (9.8)
3 Violator  (9.8)
4 Acidchild  (9.7)
5 Starlight  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.048 sec.