Basic Stamp 2 timing
R0y4L
Posts: 23
Hello Basic Stamp geeks
So, I have wrote a clock script. Feeling so proud of myself, even though it is such a simple thing. But I have a problem. To time my clock I use PAUSE 1000, from what I know this is a 1 second. But I have noticed that my clock gets 3 minutes behind after one hour. Hmmmmm...could any one help me out with this problem.
Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Visit: www.vbnoobs.co.uk
So, I have wrote a clock script. Feeling so proud of myself, even though it is such a simple thing. But I have a problem. To time my clock I use PAUSE 1000, from what I know this is a 1 second. But I have noticed that my clock gets 3 minutes behind after one hour. Hmmmmm...could any one help me out with this problem.
Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Visit: www.vbnoobs.co.uk
Comments
they will take appreciable time to execute. In order to take this extra time
into account try reducing the PAUSE from 1000 to 950. This should get
you better timing accuracy, but most likely it will still be off by a little bit.
phil
Three minutes is about ( 3 * 60 * 1000) mSec = 180,000 mSec. So,in one hour, out of a total of 3,600,000 mSec you're out about 5%; not too bad really.
You can play with your Pause value (maybe down to 950 or so )and do another test.
Or for $5 - $10 get a DS1302 timekeeper chip and be right on.
Cheers
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
However, after some a bit more testing of my clock code I have noticed that my calculations weren't 100% correct. I decided to do a smaller range test to see how behind my code gets. I have discovered that my clock time gets behind 2 mins in 10 min period. So in one hour I get about 720.000 mS of lost time. That is 20%. And I think this is a lot. I was just wondering/thinking about a calculation/formulae that would allow me to calculate how many mS does that 20% take. If, I get the result in mS, then I can divide it by 6,meaning ill get a result that shows me how mS I am off in 10 min period. Then divide the result in mS by 10, and ill get a result of how many mS I am off in one min. Take the result away from 1000 mS and i should have my offset. I hope this doesn't sound too confusing. I think, I can imagine the process in my head. Do yous think I am on some kind of right track? I'd rather calculate everything myself too [noparse]:)[/noparse] I am intrigued about the idea of reducing the time in mS in my code to allow other parts of code to be executed in that 1000 mS range.
Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Visit: www.vbnoobs.co.uk
Thank you
I guess thread can be closed. Or if people have any more questions relating to this please leave it open. Maybe any one has more ways of calculating time using PAUSE?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Visit: www.vbnoobs.co.uk
actual time is off as a first approximation to the correction. Refine it as
you make more measurements.
In this case, drop it by 20 percent or 200. It then becomes PAUSE 800.
phil