HP Forums
HP-15C time calculating program - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: HP-15C time calculating program (/thread-22247.html)



HP-15C time calculating program - lomchivok - 08-29-2024 05:48 PM

I have a thermal cooking process for canned salmon that needs to be timed for a specific amount of time.
The process time is 4 hrs and 34 min.
I have written a program that calculates the cook time correctly but displays the calculated process time in 24 hour format ie. 12:00 start time and 4 hrs and 34 min later it is done cooking at 4:34 but displays 16:34.
I need a subroutine that takes the integer and subtracts 12 from it if the integer is greater than 12 and displays the calculation in 12 hour format.
Here is my program that calculates the process time in 24 hour format.
F LBL A
G>H
STO 3
4.57 (= 4 hrs 34 min in decimal hours)
ENTER
RCL 3
+
F >HMS
Sto 2
G RTN
Any help would be much appreciated


RE: HP-15C time calculating program - Thomas Klemm - 08-30-2024 03:42 AM

Something like this?
Code:
   001 { 42 21 11 } f LBL A
   002 {    43  2 } g ->H
   003 {        4 } 4
   004 {       48 } .
   005 {        3 } 3
   006 {        4 } 4
   007 {    43  2 } g ->H
   008 {       40 } +
   009 {    42  2 } f ->H.MS
   010 {       36 } ENTER
   011 {    43 44 } g INT
   012 {        1 } 1
   013 {        2 } 2
   014 { 43 30  8 } g TEST 8
   015 {    22  0 } GTO 0
   016 {       33 } Rv
   017 {       33 } Rv
   018 {    43 32 } g RTN
   019 { 42 21  0 } f LBL 0
   020 {       34 } X<=>Y
   021 {       33 } Rv
   022 {       30 } -
   023 {    43 32 } g RTN



RE: HP-15C time calculating program - Werner - 08-30-2024 12:50 PM

from step 10 onwards:

Code:
   010 {        1 } 1
   011 {        2 } 2
   012 { 43 30  9 } g TEST 9
   013 {    43 35 } g CLX
   014 {       30 } -
   015 {    43 32 } g RTN

Cheers, Werner


RE: HP-15C time calculating program - Thomas Klemm - 08-30-2024 02:25 PM

Except that for 8 the result should probably be 12.3400 and not 0.3400.


RE: HP-15C time calculating program - C.Ret - 08-30-2024 04:06 PM

Yes, indeed it is very tempting to use a modulo of 12 to simplify the code.
But a modulo of 12 returns numbers between 0 and 11. Here, we need an interval between 1 and 12. A small shift can do the trick in a minimum of steps:
Code:
001-42,21,11   f LBL A
002-    43 2   g →H
003-45,40,25     RCL+I
004-45,30, 1     RCL-1
005-45,10, 0     RCL÷0
006-   42 44   f FRAC
007-45,20, 0     RCL×0
008-45,30, 1     RCL+1
009-    42 2   f →H.MS
010-   43 32   g RTN
With parameters:
f FIX 4
12 STO 0 for 12-O'Clock systems (Alternatively 24 STO 0 for 24hr dial systems).
1 STO 1 for 1 - 12 hours range (Alternatively 0 STO 1 for 0-23 range display).
4.3400 g →H STO f I to get 4 h 34 min 00 second reacting length time.
Usage: Enter starting time and press f A, the HP-15C display the ending time.
Examples: Typical 12-hour clock system: 12 STO 0, 1 STO 1, 4.34 g →H STO f I
7        f A        ⇒        11.3400
7.30      f A        ⇒        12.0400
8        f A        ⇒        12.3400
8.23      f A        ⇒        12.5700
8.3015     f A        ⇒        1.0415
9        f A        ⇒        1.3400
9.4523     f A        ⇒        2.1923
11.15      f A        ⇒        3.4900
12.05      f A        ⇒        4.3900


RE: HP-15C time calculating program - Werner - 08-30-2024 04:13 PM

I *knew* I had replied too quickly, and there had to be a catch!

Code:
   010 {        1 } 1
   011 {        3 } 3
   012 {    43 10 } g x<=y
   013 {        1 } 1
   014 { 43 30  7 } g TEST 7
   015 {       36 } ENTER
   016 {       30 } -
   017 {       30 } -
   018 {    43 32 } g RTN

Cheers, Werner


RE: HP-15C time calculating program - lomchivok - 09-04-2024 06:17 PM

(08-30-2024 03:42 AM)Thomas Klemm Wrote:  Something like this?
Code:
   001 { 42 21 11 } f LBL A
   002 {    43  2 } g ->H
   003 {        4 } 4
   004 {       48 } .
   005 {        3 } 3
   006 {        4 } 4
   007 {    43  2 } g ->H
   008 {       40 } +
   009 {    42  2 } f ->H.MS
   010 {       36 } ENTER
   011 {    43 44 } g INT
   012 {        1 } 1
   013 {        2 } 2
   014 { 43 30  8 } g TEST 8
   015 {    22  0 } GTO 0
   016 {       33 } Rv
   017 {       33 } Rv
   018 {    43 32 } g RTN
   019 { 42 21  0 } f LBL 0
   020 {       34 } X<=>Y
   021 {       33 } Rv
   022 {       30 } -
   023 {    43 32 } g RTN
Thank you Thomas, Werner and all that have helped.
Thomas and Werner's program will work the best for me in that I have 4 different container sizes in our Alaska plant...1/4 lb, 1/2 lb, 1 lb and 4 lb... that have their own scheduled process time.
I need a program for each process and this allows me to assign a program letter to each process and just change the process time within the program. I don't want the operator to do anything other than enter the time the process starts to alleviate any confusion. A 1 minute short process generates a ton of paperwork and possibly a re-process if too short. All of our thermal process records are individually inspected by USFDA and must be correct or corrected sufficient to meet their guidelines. It's not difficult to do the math on paper but when an operator is working in a 90 degree steam saturated environment for 18 hours, mistakes start to happen that we cannot afford. We have 8 retorts for thermal processing. Each retort load of 1/4 lb cans holds 28,000 cans...mistakes can be costly.
I did write a program for this in the mid 80's but lost the program and haven't used this calculator in 30 years...it's slowly coming back to me now.
Once again thanks to all that have helped.