The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

Creating an App, and evolution for the extreme beginner (me)
Message #1 Posted by Geoff Quickfall on 19 Oct 2013, 5:15 p.m.

Hello all,

a post for newbies like me that have a million questions so here goes a very Basic (excuse the pun) of App and program installation. You will see two sections near the end of the program that are not finished yet: "WEIGHTED BREAK",WB() and "LONG SHORT BREAK",LS().

i hope this helps people whose Prime has just shown up on their door step.

This example is very crude as I am getting to know my new friend, thanks Cyrille and Tim; or; Tim and Cyrille et al.

This is strictly for you beginners and not the Mandlebrot design team or Table of the Elements group! Just a starters guide as I learn the system. So output is not yet perfected (i want a list for that). Input is awkward as I want a list for that similar to the 48 system were all inputs are menu and complete on one page. I will be getting there but getting the routine running and calling subroutines is the object. The bells and whistles come later!

This is a copy/paste clip of a text file residing in Word. It can be copied directly from here and via the Connectivity kit, copied to your emulator or Prime by creating an App using the Save App command and giving it an appropriate name. Open the new App, click on program and paste. Save to the emulator or Prime, whichever you are using.

Here is the info section which can also be copied and pasted to the info section of your emulator or prime associated with your new APP:

Break schedules: 
-calculates break periods. 

*Initialize: -prompts for "off and on" times. these are the airborne and landing times. -break "out and in" times. these are the delay and early return times in minutes after takeoff and before landing. -number of breaks.

*equal breaks: -2, 4, 6 typically.

*weighted breaks: -allows the front half or rear half of the breaks to be longer by choice. -4 or 6 typically.

*2 short followed by 3 long and short: -places the sleep period outside the dinner service.

End Info notes section and here is the listing. There are a lot of notes, more so for the Word file but still copyable to the calc due to the //

NOTE THE ->HMS COMMAND NEEDS TO BE INPUT VIA THE CALC AS THE TEXT EDITOR FAILS TO INTERPRET IT.

//declare MIDNIGHT a subroutine for use in this App.

MIDNIGHT();

//create variables.

EXPORT OFA,OFB,ONA,ONB,WTD; EXPORT IN,OUT,NUM,EQL,TIM; EXPORT TOT,CAL,PER;

//title of App

EXPORT Break_schedules() BEGIN END;

//initialize routine setting parameters and declaring local variables.

VIEW "Initialize",IT()

BEGIN HFormat:=1; HDigits:=2; HAngle:=1; STARTVIEW(6,1);

//local variables, some not used YET but will be.

LOCAL A,B,C,D; END;

// input times and break number.

VIEW "Input times/# of breaks",OO()

BEGIN

INPUT(OFA,"Wheels off time","off time = ","off time"); INPUT(ONA,"Wheels on time""on time = ","on time"); INPUT(OUT,"Out time","out time = ","out time"); INPUT(IN,"In time","in time = ","in time"); INPUT(NUM,"# of breaks","# of breaks = ","# of breaks");

//convert HMS into HR (decimal time).

OFA:=(FP(OFA)/60)*100+IP(OFA); ONA:=(FP(ONA)/60)*100+IP(ONA); OUT:=(FP(OUT)/60)*100+IP(OUT); IN:=(FP(IN)/60)*100+IP(IN);

//correct for GMT landing time less then GMT takeoff time //for when flight passes through 24:00 GMT.

IF OFA>ONA THEN ONB:=ONA+24 ELSE ONB:=ONA; END;

//calculate actual times for break using delay after takeoff //and early return before landing.

ONB:=ONB-IN; OFB:=OFA+OUT; TOT:=ONB-OFB; EQL:=->HMS(TOT/NUM);

//display equal breaks and time availble for breaks.

MSGBOX("Equal = "+EQL); MSGBOX("Total = "+TOT);

END;

//select type of break desired based on EQL and TOT above.

VIEW "EQUAL BREAK",EQ()

//this is a loop using NUM variable to control loop.

BEGIN FOR N FROM 1 TO NUM DO

TIM:=->HMS(OFB+EQL); TIM:=MIDNIGHT(TIM); OFB:=TIM;

//display the consecutive times.

MSGBOX("Time = " +TIM+"");

END; END;

//end loop

VIEW "WEIGHTED BREAK",WB()

BEGIN

INPUT (WTD,"Weighted time""weighted time = ","weighted time"); INPUT (PER,"Period","Period = ","period");

WTD:=(FP(WTD)/60)*100+IP(WTD); CAL:=->HMS((TOT-(NUM/2*WTD))/2);

MSGBOX("CALC = " +CAL+"");

END;

VIEW "LONG SHORT BREAK",LS() BEGIN END;

Here is the subroutine Midnight which checks to see if the time additives pass through 24:00 hours and then corrects the output for display.

EXPORT MIDNIGHT(TIM)
BEGIN
  IF TIM>24 THEN TIM:=TIM-24
    ELSE TIM:=TIM; 
END;
END;

The point of the above post was just to get you started with an example, believe me, it takes quite a while (for me anyway) to interpret the DICE APP and convert the knowledge in that to my program.

The program is not finished as two sections are WIP's and the input and output displays are not refined.

cheers, Geoff

comments and suggestions welcome, but most of the fun and learning is just trying!

Edited: 20 Oct 2013, 1:14 a.m. after one or more responses were posted

      
Re: Creating an App, and evolution for the extreme beginner (me)
Message #2 Posted by Han on 19 Oct 2013, 7:26 p.m.,
in response to message #1 by Geoff Quickfall

If you are interested in creating a custom app, this video might be of interest:

http://www.youtube.com/watch?v=hv-MMwfzwwA

            
Re: Creating an App, and evolution for the extreme beginner (me)
Message #3 Posted by Geoff Quickfall on 19 Oct 2013, 7:54 p.m.,
in response to message #2 by Han

That is a good video, and indeed it did help.

But, oops, this is an App called Breaks ;-)

i also have an aviation App which contains a series of programs from great circle, intermediate latititude, altitude corrections due to non standard temperature, pressure altitudes greater then 31.00 inches.

Here is the Breaks App at the moment:

and so on...

Cheers

Geoff

Edited: 19 Oct 2013, 11:58 p.m.

                  
Re: Creating an App, and evolution for the extreme beginner (me)
Message #4 Posted by Bruce Bergman on 20 Oct 2013, 12:45 a.m.,
in response to message #3 by Geoff Quickfall

This is AWESOME Geoff! I mean, sorry you had to do a lot of work for the rest of us, but great that you're willing to share! I'm thinking about creating an app of my own for some additional statistics functions, and this will help a lot.

Kudos!

bruce

                        
Re: Creating an App, and evolution for the extreme beginner (me)
Message #5 Posted by Geoff Quickfall on 20 Oct 2013, 1:27 a.m.,
in response to message #4 by Bruce Bergman

Thanks Bruce.

I will get it to the Wiki soon, also this is a WIP and I will post the complete App with program code, pictures of screens and maybe throw in a video.

Now to finish the last two sections. Yes, in the cockpit in between radio and navigation duties :-)

Geoff


[ Return to Index | Top of Index ]

Go back to the main exhibit hall