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 > Accurately Measuring Drive RPM
2020-08-03 16:07
chatGPZ

Registered: Dec 2001
Posts: 11108
Accurately Measuring Drive RPM

To bring the discussion from 1541 Speed Test into the forum....

first lets recapitulate:

The general idea is: have a "marker" on a track, then measure the time for one revolution using timers. Generally there are different ways to achieve this:

- wait for the marker and toggle a IEC line. the C64 measures the time using CIA timer. this is what eg the well known "Kwik Load" copy does, the problem is that it is PAL/NTSC specific, and it can never be 100% exact due to the timing drift between drive and C64.

- wait for the marker and measure the time using VIA timers on the drive. the problem with this is that VIA timers are only 16bit and can not be cascaded, so you either have to measure smaller portions at a time, or rely on the wraparound and the value being in certain bounds at the time you read it.

now, to make either way slightly more accurate, a special kind of reference track can be used. typically this track will contain nothing except one marker - which makes the code a bit simpler and straightforward. this is what 1541 Speed Test does. the DOS also does something similar when formatting, to calculate the gaps. This obviosly has the problem that we are overwriting said track.

Now - the question isn't how to do all this, that's a solved problem. The question is, given a specific implementation, how *accurate* is it actually, and why?

The basic math to calculate the RPM is this:

expected ideal:
300 rounds per minute
= 5 rounds per second
= 200 milliseconds per round
at 1MHz (0,001 milliseconds per clock)
= 200000 cycles per round

to calculate RPM from cycles per round:
RPM = (200000 * 300) / cycles

two little test programs are here: https://sourceforge.net/p/vice-emu/code/HEAD/tree/testprogs/dri.. ... the first reads timer values between each sector header and then the total time for a revolution is accumulated from the delta times. the second leaves the timer running for one revolution and then indirectly gets the time for a revolution from that. to my own surprise, both appear to be accurate down to 3 cycles (in theory the second one should be more accurate, at least thats what i thought. i also expected some more jitter than just 3 cycles)

1541 Speed Test writes a track that contains one long sync, and then 5 regular bytes which serve as the marker. it then reads 6 bytes and measures the time that takes, which equals one revolution. somehow this produces a stable value without any jitter, which was a bit surprising to me too (i expected at least one cycle jitter, due to the sync waiting loops) (i am waiting for the source release and will put a derived test into the vice repo too)

So, again, the question is... how accurate are those and why? (a stable value alone does not tell its accurate). Some details are not quite clear to me, eg if we are writing a reference track, how much will that affect the accuracy of the following measurement? how will the result change when the reference track was written at a different speed than when doing the measuring? Will using a certain speedzone make it more or less accurate?

Bonus question: can we use https://en.wikipedia.org/wiki/Chinese_remainder_theorem with two VIA timers to make this more accurate? or is it a pointless exercise?
 
... 263 posts hidden. Click here to view all posts....
 
2020-08-08 19:00
chatGPZ

Registered: Dec 2001
Posts: 11108
Quote:
well if someone uses an original disk to make some tests, he deserves to trash it, who with a sane mind would do that? =)
We can all agree that a warning before it starts testing should a better solution.

Indeed, it's much more likely someone runs this disk from his tool disk, with the tool disk in the drive, than that he will put an original disk into the drive. That also means that destroying a random track without asking is much more likely a problem than relying on a track being in CBM DOS format :)
2020-08-08 19:49
Zibri
Account closed

Registered: May 2020
Posts: 304
Quoting SLC
Sometimes you may want to use the actual disks you want to read for reference for whatever reason. Having no alignment disks I've several times used originals as reference for example (Though, I always write protect)
Write protect in 1541 is only software. Even with my program, you can write protect the disk as you want but it writes on it.
Check out the other version "rpm3wrong.prg". That does not write anything. But still I prefer the released version.
2020-08-08 19:55
Zibri
Account closed

Registered: May 2020
Posts: 304
Quoting SLC
@Zibri:

You don't respond well to any form of criticism it appears. Your routine may be accurate, but a lot of what you write comes out wrong. And your attitude sucks. Even flaws that actually is of concerns is brushed off as an attack on your precious code.
Ilove you too :P
Quoting SLC

bla bla bla gne gne gne

My program stiil does what it promises.
It is the most accurate, fast and "nice" as of the time of publishing.
Sorry for bruising so much your egos with a program that anybody could have written in 40 years.
Clearly nobody cared (I bet Krill was able) or was not able (Groepaz) to do it.
Sorry again. For me was just fun to write and see it working.
So easy that even a kid can use it.
So precise that can show flaws in capacitors or belt or other components.
That's all I wanted to do. I did it. It was fun.
And, by the way, it wasn't even me releasing it here on this troll infested forum/website.

Ciao.
2020-08-08 19:56
Zibri
Account closed

Registered: May 2020
Posts: 304
Quoting ChristopherJam
Well, yes - your utility accurately reports to two significant figures, mine does to one significant figure.

This is called a 10 time jump in precision.
Exactly my point.
2020-08-08 20:06
Nerdine
Account closed

Registered: Nov 2012
Posts: 2
Quoting Zibri
Quoting SLC
@Zibri:

You don't respond well to any form of criticism it appears. Your routine may be accurate, but a lot of what you write comes out wrong. And your attitude sucks. Even flaws that actually is of concerns is brushed off as an attack on your precious code.
Ilove you too :P


q.e.d
2020-08-08 20:09
Fungus

Registered: Sep 2002
Posts: 616
Write protect is hardware, learn to read schematics smooth brain.
2020-08-08 20:13
BiGFooT

Registered: Mar 2002
Posts: 31
Quoting Zibri

Sorry for bruising so much your egos with a program that anybody could have written in 40 years.


I can't hold it back anymore. The only people in this thread who have problem with "ego" is you. I followed the whole thing from the beginning and what I've learned is this:
- your code is the most accurate and best and everyone else suck
- it's the most accurate and best because you say so, and whoever wants to discuss his thoughs and problems with you is seems like an idiot

I don't know if the problem is your attitude or it's because of the language differences but you talk off really talented guys here, like you pulled 'em out from your ass.

Some people want to learn, but it seems that you're not a (good) teacher. I was interested in the _deep_ technical details and I got more information from the others than you. Trust me, teaching others is a good thing, you should be proud of that, also a good leader shows the way and not talk people down.

Inteligent people starts to think, when more and more people says that something is wrong. I hope that you're also one...
2020-08-08 21:18
Zibri
Account closed

Registered: May 2020
Posts: 304
Quoting BiGFooT
Quoting Zibri

Sorry for bruising so much your egos with a program that anybody could have written in 40 years.


I can't hold it back anymore. The only people in this thread who have problem with "ego" is you. I followed the whole thing from the beginning and what I've learned is this:
- your code is the most accurate and best and everyone else suck
- it's the most accurate and best because you say so, and whoever wants to discuss his thoughs and problems with you is seems like an idiot

I don't know if the problem is your attitude or it's because of the language differences but you talk off really talented guys here, like you pulled 'em out from your ass.

Some people want to learn, but it seems that you're not a (good) teacher. I was interested in the _deep_ technical details and I got more information from the others than you. Trust me, teaching others is a good thing, you should be proud of that, also a good leader shows the way and not talk people down.

Inteligent people starts to think, when more and more people says that something is wrong. I hope that you're also one...

People who tanto to learn don't attack me as Groepaz did in a lame passive-aggressive way.
Whoever knows me personally, knows I am a very kind and funny person who jokes almost all the time and does not take anything seriously.
They also know me as a person who loves to learn and tech to others (I have done many things in my life including courses).
Sincerely there is only a couple of people, in this discussion, who I could learn from.
What made me answer less "funnily" and more "rudely" were people just bad mouthing a program they clearly have not even tested and compared it to other programs they probably didn't test or use.
I coded this program for fun and to prove a more accurate, usable and good looking program could be done.

About the people who supposedly want to learn, I told them how my program works.
So I really don't understand why all this fuss.
And strangely, the loudest voice in this discussion comes from the guy who made the most horrible and unusable program. That hurts. The eyes. :P

Now a challenge on getting rid of the 3 cycle jitter and achieve a 3 digit accuracy, that would be interesting!
That would teach me something.

But here clearly nobody really want to learn something otherwise someone would have asked how did I do the "non writing" version in so little time and changing just a few lines of my original code.

Sorry but I see no friendship in this forum, nobody wishing to learn and nobody (excpet the usual 2 people) tying to offer a real advice and some coding examples.

I repeat: I didn't release this program on csdb. They just informed me of this. And I came here more by curiosity than to prove anything.

I am not amused by this mainly toxic environment.

I apologize with the "few good men" reading all this thread.
2020-08-09 09:39
Frantic

Registered: Mar 2003
Posts: 1627
I wonder if it is the Dunning-Kruger effect in play. At least when it comes to social/communication skills.
2020-08-09 15:00
Adam

Registered: Jul 2009
Posts: 321
Quoting Zibri

it wasn't even me releasing it here on this troll infested forum/website.

It's always the way: people magically become trolls as soon as a disagreement arises. That's not quite how it works, zibri. You aren't on twitter, facebook or your youtube channel where you can control who says what in your echo chamber circlejerk. If you really feel this way about CSDb, just don't log in ever again. Easy.

Quote:
So I really don't understand why all this fuss. I am not amused by this mainly toxic environment.

You've been the #1 cause of toxicity in this entire thread as far as I'm concerned. People tried to help but you insult them and reply in a disrespectful way that has got you absolutely nowhere. Well done. Ciao. :)
Previous - 1 | ... | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | ... | 28 | 29 - 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
Frostbyte/Artline De..
Guests online: 118
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 Graphicians
1 Sulevi  (10)
2 Mirage  (9.8)
3 Lobo  (9.7)
4 Mikael  (9.7)
5 Archmage  (9.7)

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