Interval timer on DM41(L): iffy accuracy

This is the place to discuss the usage of DM1x/DM41 machines and to share any tips & tricks you may have stumbled across.

If discussing a specific model, please ensure that you prefix topic subjects with the model number this way:

[DM41] How to change the number of program steps available
Post Reply
keithdalby
Posts: 564
Joined: Mon Apr 24, 2017 8:38 pm

Interval timer on DM41(L): iffy accuracy

Post by keithdalby »

Wrote a program to beep regularly with a given number of seconds between each beep. Useful for a lab where you're taking measurements every X seconds and don't want to keep an eye on a timer.

Problem is, the clock isn't very accurate and when I run this along side a stopwatch the difference is very noticeable indeed. Some beeps as as much as a fifth of a second out. May not seem like a lot, but I wonder if there's a way to improve the clock accuracy? Or is this more a problem of the program execution time being so variable?

Code: Select all

LBL BEEPER
"INTERVAL=?"
PROMPT
STO 01
TIME
HR
3600
×
STO 02
0
STO 03
LBL 01
RCL 01
RCL 03
×
RCL 02
+
TIME
HR
3600
×
X<=Y?
GTO 01
TONE 6
"N="
ARCL 03
AVIEW
1
ST+ 03
GTO 01
END
grsbanks
Posts: 1122
Joined: Tue Apr 25, 2017 11:23 am
Location: Preston, Lancs, UK
Contact:

Re: Interval timer on DM41(L): iffy accuracy

Post by grsbanks »

Keith,

How high is "X"?

The problem with the way you're doing this is the time taken for each iteration of the loop that determines when it's time to take a measurement.

For values of "X" greater than 10 seconds, I'd change tack and set up a repeating control alarm to run a program that takes the measurement.

A) it should be more accurate, and
B) you're not running the CPU at 100% in a a loop
There are only 10 kinds of people in the world: those who understand binary and those who do not.
keithdalby
Posts: 564
Joined: Mon Apr 24, 2017 8:38 pm

Re: Interval timer on DM41(L): iffy accuracy

Post by keithdalby »

Mmmm, X can be as low as a couple of seconds. I also think that, because it's checking a difference in time from the internal clock, the time for actually running the program shouldn't cause the intervals to drift too much cumulatively. A few ms delay in a beep is fine - as long as it's consistent. I suppose it would average out in the end, but the noticeable ebb and flow of the beeping during operation bugs me a bit.

Why would you only use the XYZALM (or whatever) for values of X greater than 10?
grsbanks
Posts: 1122
Joined: Tue Apr 25, 2017 11:23 am
Location: Preston, Lancs, UK
Contact:

Re: Interval timer on DM41(L): iffy accuracy

Post by grsbanks »

The noticeable ebb and flow comes from the fact that it probably takes several hundred milliseconds to run each iteration of your loop. The DM41 is not a fast calculator by any stretch of the imagination. Certainly much faster than the original HP-41CX but that speed improvement is not as pronounced as it is with, for example, the DM15 or DM11.

The ten-second figure comes from the manual for the Time Module (built into the 41CX), which gives this as a figure below which the accuracy of the timer goes a bit pear shaped.
There are only 10 kinds of people in the world: those who understand binary and those who do not.
keithdalby
Posts: 564
Joined: Mon Apr 24, 2017 8:38 pm

Re: Interval timer on DM41(L): iffy accuracy

Post by keithdalby »

grsbanks wrote:
Thu Feb 01, 2018 2:48 pm
it probably takes several hundred milliseconds to run each iteration of your loop.
That makes sense, although I'm surprised it is so high. I am being naïve (again) in expecting the same program steps to produce the same latency every iteration, aren't I?
keithdalby
Posts: 564
Joined: Mon Apr 24, 2017 8:38 pm

Re: Interval timer on DM41(L): iffy accuracy

Post by keithdalby »

grsbanks wrote:
Thu Feb 01, 2018 2:48 pm
The ten-second figure comes from the manual for the Time Module (built into the 41CX), which gives this as a figure below which the accuracy of the timer goes a bit pear shaped.
In suppose I could include a conditional test that uses the code here for small intervals and a repeating XYZALM for intervals longer than 10s, but I doubt there'd be much point.
Post Reply