The following warnings occurred:
Warning [2] Undefined array key 85895 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 85904 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 85905 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 85911 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 85912 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 85913 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 85916 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 85920 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $thread - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $fid - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 85912 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 85920 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $lang - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Attempt to read property "messages_in_thread" on null - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks





Timer function for repeated delay?



#9

I'm looking for a delay timer function for the HP 41CX or any other HP calculator. I want to create a program that does the following:

 1) Accept a number of rounds
2) Accept a delay in seconds
3) Delay execution for the given delay time
4) Increment round number
5) If the requested number of rounds is reached
6) sound a long beep
7) stop
else
8) sound a short beep
9) go to (3)

I checked the CX timer functions but couldn't find a match. Can the stopwatch functions be used to implement this?

What is the easiest way to produce different beeps (without synthetics.)?


#10

First the easy question:

> What is the easiest way to produce different beeps (without synthetics.)? 

TONE accepts an argument 0 through 9, and it produces different
beeps according to the argument, giving you 10 different TONEs. With synthetics you can have around 99 different TONEs.

Now for the difficult question:

If I understand correctly, you essentially want a routine which suspends the execution of a program for n seconds, where n is supplied as a parameter.

In other words something like the Unix sleep n command.

If the stopwatch allowed you to call a function when it crossed zero, this would have been trivial to do. Unfortunately to the best of my knowledge, when the stopwatch timer crosses zero, it just makes some noices until you tell it to go away.

So there are two workarounds:

a) use STOPSW 0 SETSW RUNSW to start the stopwatch and have a
loop that repeatedly calls RCLSW and tests it against n. I am not really sure whether this will get you the required resolution though (i.e it may be slow by a second or two).

b) set an alarm in the future. For example

	"^^WAKEUP"
0
DATE
TIME
increment time by n seconds
XYZALM
OFF
LBL "WAKEUP
continue execution

This is a simplified algorithm which has a serious bug, namely it does not work near midnight when the date changes during the sleep period. In this case the n + TIME will be greater than 23.59599 and will be rejected by XYZALM.

Adding enough code to ensure that this works in the general case, will increase execution time by many seconds, affecting resolution.

**vp


Edited: 21 Jan 2006, 1:40 a.m.


#11

Quote:
This is a simplified algorithm which has a serious bug, namely it does not work near midnight when the date changes during the sleep period. In this case the n + TIME will be greater than 23.59599 and will be rejected by XYZALM.

Not really a big problem (see the Ultimate Alarm Clock how this was solved).

#12

XYZALM allows you to put in the repeat interval, and starting the string in alpha with ^^ makes it a control alarm that will begin execution at the label whose name follows the ^^ in alpha. That program could do your incrementing, comparing, and beeping, and if it has reached the last one you wanted, clear the alarm to stop the repetition. If there is no label name after the ^^ in alpha when you set the alarm, then execution will resume where it had stopped the last time. The 41 does not need to be off for the alarm to work and take control. The first alarm time may need to be calculated. After that they will keep coming at the interval you specified until you (or your program) clear the alarm. This interval will not depend on execution speed, but you will want the execution to be completed before the alarm comes due the next time. IOW, if you want every 30 seconds, and the program takes 3 seconds to execute every time, and then you add more lines and it takes 8 seconds every time, it doesn't matter. The alarm will still come up every 30 seconds as specified, regardless.

User beeps are numbers 0-9 and are all the same length. Synthetic beeps allow different lengths and pitches, and range from 10-129. I might suggest TONE 7 and TONE 87, which are the same pitch but 7 is about three times as long as 87.


#13

Garth Wilson wrote:
> XYZALM allows you to put in the repeat interval ...

You are right. For some reason I thought Marcus required different timeouts depending on the round. Silly of me.

So, Marcus, if you want the reminder to be every n seconds, do as Garth suggested.

Note, however, that my warning regarding the date is still valid (i.e. make sure that TIME + n <= 23.59599).
Luckily this is required only for the first alarm. Repeat alarms will be handled by the Timer Module.

Another issue is how to stop the alarms once the required number of iterations has been reached. On a non-CX with a TIME module, you have to clear the alarm manually. On a 41CX you can use the CLALMA command to clear the alarm.

Finally be careful that the execution time of the program is shorter than the specified time interval. Otherwise the alarm processing routine will be interupted by the next alarm and so on, till you get in a total mess.

**vp


So here is an example program

; REPTMR -- Repeat Timer
; X iterations (i)
; Y sleep interval in seconds (ss)

01 LBL "REPTMR
02 STO 00 ; store i in R00
03 RDN ; bring ss to X register
04 1 E4 ; change ss to 0.00ss
05 /
06 "^^RING ; unconditional alarm function
07 0 ; use 0 to indicate that the alarm is due today
08 TIME
09 RCL Z ; bring 0.00ss into X-Register
10 + ; X := TIME + ss seconds
; here you are supposed to check if X > 23.59599 and do smth about it
11 XYZALM ; set the alarm
12 OFF ; wait

13 LBL "RING
14 DSE 00
15 GTO 01

16 BEEP ; final beep
17 CLALMA ; clear alarm
18 OFF ; terminate


19 LBL 01 ; repeat beep
20 TONE 3
21 TONE 3
22 OFF ; wait


#14

Thanks to both of you!

There is an additional difficulty: I want to be able to suspend execution after each beep with a key. Why? The timer is intended to monitor an IQ test with a given number of seconds for each question. Now what if my telephone rings?

I'll probably go for a simpler aproach that requires to hit a key to advance to the next round. This requires to reprogram the timer for each round but is much more flexible for the user. I'll keep you informed - about both the program and my IQ ;-)

Marcus


#15

Marcus von Cube wrote:
> There is an additional difficulty: I want to be able to suspend
> execution after each beep with a key.

Why didn't you say so from the beginning??????

It changes the whole program design!

In this case I'd use the GETKEYX command (HP-41CX only) which
takes the number of seconds to wait for the key as argument.

So you can use this program

; REPTMR -- Repeat Timer
; X iterations (i)
; Y sleep interval in seconds (ss)

01 LBL "REPTMR
02 STO 00 ; store i in R00
03 RDN ; bring ss to X register
04 LBL 00
05 VIEW 00 ; (optional) display countdown value
06 TONE 3 ; beep to let user know start of interval
07 GETKEYX ; wait for X seconds
08 X<>0? ; if nothing pressed, skip STOP
09 STOP ; freeze program
10 LASTx ; recover timeout value
11 DSE 00 ; decrement count
12 GTO 00
13 BEEP
14 END

If you press a key while it waits, it will stop (line 09). Pressing R/S will cause it to continue

So as friend used to say tell me what you want to do, not how you think you should do it :-)

**vp


#16

Hi Vassilis,

I was asking for a delay function in the first place. GETKEYX seems to be what I was asking for. I'll modify your solution slightly because I need to restart the round if it's interrupted. I like this aproach because it leaves the control to the program, not to an external timer.

Thanks again to all who replied.

Marcus


Possibly Related Threads…
Thread Author Replies Views Last Post
  HP50g: Writing a function that returns a function Chris de Castro 2 2,063 12-10-2013, 06:49 PM
Last Post: Han
  [Prime] Shutdown timer bug? Cristian Arezzini 2 1,593 11-16-2013, 10:34 AM
Last Post: Cristian Arezzini
  Apologies on mail delay. Diego Diaz 0 737 11-07-2012, 02:27 PM
Last Post: Diego Diaz
  New Blog Entry (repeated functions) is now up Eddie W. Shore 0 741 02-08-2012, 10:10 PM
Last Post: Eddie W. Shore
  Kitchen timer on 17B/17BII/17BII+/19B/19BII/27S y.miyata 1 1,023 03-04-2010, 12:18 PM
Last Post: Martin Pinckney
  hp 45 conversion to quartz timer Geoff Quickfall 5 1,533 01-22-2008, 08:44 PM
Last Post: Geoff Quickfall
  Timer with splits Sam Levy 2 1,037 06-09-2007, 03:42 PM
Last Post: Maximilian Hohmann
  33s repeated operations Sam Levy 2 981 03-13-2007, 10:11 AM
Last Post: Hal Bitton
  48GX computing delay Steve Jirsa 7 1,836 12-02-2005, 05:45 PM
Last Post: Arnaud Amiel
  HP-45 TIMER ROUTINE Hank 1 793 05-15-2005, 02:01 PM
Last Post: GWB

Forum Jump: