The HP41CX "ATIME" function question



#4

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!!!!!


#5

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.


#6

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.


Possibly Related Threads...
Thread Author Replies Views Last Post
  HP50g: Writing a function that returns a function Chris de Castro 2 494 12-10-2013, 06:49 PM
Last Post: Han
  HP Prime EVAL function question Jonathan Cameron 2 324 09-28-2013, 08:58 PM
Last Post: Han
  HP41CX: Strange serial #... Stephan Matthys 1 279 09-13-2013, 01:38 PM
Last Post: Stephan Matthys
  Using PIL-BOX & ILPer to Transfer Programmes from PC to HP41CX? Michael Lopez 5 493 06-25-2012, 09:31 AM
Last Post: Michael Lopez
  Re: more HMS, aTIME, 34s display, 41c bugs? Christopher Johnson 0 175 03-05-2012, 11:20 AM
Last Post: Christopher Johnson
  more HMS, aTIME, 34s display, 41c bugs? Christopher Johnson 2 283 02-25-2012, 10:06 PM
Last Post: Luiz C. Vieira (Brazil)
  HP-80 Function Question Kerem Kapkin (Silicon Valley, CA) 10 746 02-14-2012, 02:09 AM
Last Post: Kerem Kapkin (Silicon Valley, CA)
  Science Project with HP41CX and Arduino? Fouad M. Kaadou 9 669 01-04-2012, 04:04 AM
Last Post: yves
  Strange HP41CX Problem - HELP! Fouad M. Kaadou 2 307 11-20-2011, 05:12 AM
Last Post: Fouad M. Kaadou
  Question about MROOT function Namir 15 916 11-09-2011, 02:16 PM
Last Post: Software49g

Forum Jump: