The Museum of HP Calculators

HP Forum Archive 18

[ Return to Index | Top of Index ]

The HP41CX "ATIME" function question
Message #1 Posted by Geoff Quickfall on 14 Oct 2008, 12:50 a.m.

I currently am programming a recently aquired HP 42S with as many of my HP41Cx programs as possible.

Of course some need minor conversions to be adaptable but there is one function missing on the HP42S that the HP41cx has that I am having problems with.

I have a schedule program which, after running the HP41cx and the infared printer will output a rest schedule formatted for the printer. The program allows you to:

with the input of:

a. start time (24 hour clock, gmt) b. finish time c. number of breaks during the time period d. enter a known 'long' period if you choose e. enter a known 'short' period instead of the long period; ex. I want the short period to be 1 hour and the rest to be the long period or, I want the long period to be 2 hours and the rest to be the short (the following example).

the output is:

a. listing the start time and finish time b. calculating the total time available c. i. dividing that into equal periods based on the number of breaks

or

ii. creating a schedule based on 2 short periods followed by 3 long periods followed by a short period. (either the short or long periods can be pre defined to create the above schedule; see above)

For example:

START= 22:35 END= 06:25 NUMBER OF BREAKS= 6 LONG BREAK= 2:00 and a selection of 2 short periods followed by 3 long followed by one short (case ii above). This gives the following PRINTER output:

START= 22:35 END= 06:25

TOTAL= 07:50

LONG= 02:00 SHORT= 00:36

# BREAKS= 6

22:35__23:11 23:11__23:48 23:48__01:48 01:48__03:48 O3:48__05:48 O5:48__06:25

The problem is the HP41CX has a wonderful all in one command that formats a decimal such as 6.25 into the alpha display 06:25. This command is the "ATIME" command. The HP42S has no such command and therefore I have to come up with a subroutine which will format the decimal HMS display to the clock time display.

I of course will call it LBL "ATIME" but currently being unfamiliar with the 42S am having a problem hacking a solution. As it stands the output is in decimal HMS mode and looks like this:

HP 42S output to the printer:

Start= 22.35 End= 6.25

Total= 7.50

Long= 2.00 Short= 0.36

# Breaks= 6

22.35__23.11 23.11__23.48 23.48__1.48 1.48__3.48 3.48__5.48 5.48__6.25

As you can see it does not line up as the preceding '0' is missing from the 3 digit time calculations. "ATIME" pre-attached the '0' to these digits.

Now I know how to test the 6.25 via alength and can send the offending time codes to the "ATIME" subroutine. I am however having trouble creating a routine to stick an 'alpha' zero in front of the 6.25. I am not that worried about the decimal point being a colon but for formatting the output (neatness freak!) I would like a routine that converts:

6.25 into 06.25

or better yet

6.25 into 06:25 as the HP41CX "ATIME" function does.

ANY takers for the challenge, which I will be working on tonight!

Cheers, Geoff wanting a neat output!!!!!

      
Re: The HP41CX "ATIME" function question
Message #2 Posted by Diego Diaz on 14 Oct 2008, 1:41 a.m.,
in response to message #1 by Geoff Quickfall

Hi again... :-)

Assuming you "only" send to "ATIME" the times smaller than 10.00 and time is in "X" register:

01 LBL "ATIME"
02 FIX 02      (trims "hours" and "minutes" only)
03 CLA
04 "0"         (inserts the heading "0")
05 ARCL ST X   (appends the "time" from "X" register)
06 AVIEW       (in case you need it, otherwise just use it directly from ALPHA register)
07 .END.

ARCL is in fact an Append function, so the time in "X" is just appended to the heading "0" placed into ALPHA in step 04.

Hope this helps.

Diego.

            
Re: The HP41CX "ATIME" function question
Message #3 Posted by Geoff Quickfall on 14 Oct 2008, 1:46 a.m.,
in response to message #2 by Diego Diaz

I honestly thought I tried that, but I don't document, I just sit and hack around using my mind as a scratch pad.

Well I am just off to bed and will try that trick!

Cheers, and thanks, Geoff

PS yes the only time period that makes it to "atime" will have less than 4 digits as defined by alength:

for example  6.25 alength is 4
            16.25 alength is 5
or

a number test; is 6.25 less than 10, yes GTO (a more elegant solution)

Geoff

Edited: 14 Oct 2008, 1:50 a.m.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall