Post Reply 
Library Tutorial
02-17-2020, 02:04 PM
Post: #1
Library Tutorial
Library Tutorial Example

Code:


//Below is where you declare Global variables used by the Solver App.
//When you declare a Global variable using the EXPORT command (line 13) it is retained by the calculator
//even when you exit the app. If you type Gain in the Home screen 
//followed by [Enter] the number stored in the variable Gain will be displayed.
// You can even type Gain*5 and if Gain = 10, the display will return 50.
//Letters A to Z do not have to be declared as they already are Global variables part of the System,
//however 'a to z' have to be declared by EXPORT (global) or LOCAL 
//Other Global variables are M0 to M9, used by Matrix, Zo to Z9 used by Complex numbers etc.
//LOCAL variables are active only while the program is running,so as not to clutter the memory space.
//Also you cannot use the word 'point' as a variable because it is a system command which is part of the 
//command list, accessed by pressing the Toolbox/Mem/B key and soft key Catlg.

EXPORT Gain,Debit,Credit,x,y,z;//Only 8 per line. This line has 6 variables, you can add two more.
//EXPORT a,b,c,d,e,f,g,h,k,KLM;This line contains 9 and will be rejected or cause error.
//' ; , " " 'are very important and will cause errors eg.  END without ; cause error.


EXPORT Library()//This is the program name. 
//Body of the program begins here line 20 and the matching END; is on the last line .
BEGIN
LOCAL lib;//lib is used below to select a particular library categories.
// it is a temporary VARIABLE used as a linl until the program is terminated.
//You do not have to use 'lib', its an arbitrary name.

//'STARTAPP' is used to start an app, in this case "Solve".
STARTAPP("Solve");
//Below is an empty equation set used when the program is started
//to clear the Solver. You can also use the second option from the MENU line 44. 
""▶E1;
""▶E2;
""▶E3;
""▶E4;
""▶E5;
""▶E6;
""▶E7;
""▶E8;
""▶E9;
""▶E0;

//Here the program will present the list of categories.
//This MENU will appear as soon as you press the [Run] key.
//
CHOOSE(lib,"Finance ",
{   
"   Quit Library",
"   Clear Solver",
"   Accounting",
"   Economic ",
"   Next Category. "
});

IF lib==0 THEN KILL; 
END;

//---------------------------------------
//lib==1 is the link to 'Quit Library'.
IF lib==1 THEN
PRINT();
PRINT("Quiting Library");
IFERR BREAK; BREAK; THEN END
END;
//------------------------------------
//lib==2 will Clear the Solver.
IF lib==2 THEN
""▶E1;
""▶E2;
""▶E3;
""▶E4;
""▶E5;
""▶E6;
""▶E7;
""▶E8;
""▶E9;
""▶E0;
END;//End of Clear Solver section
//------------------------------------
//lib==3 is the link to 'Accounting'You can add categories by doing a Copy & Paste
IF lib==3 THEN
"Gain=y/z"▶E1;
"COS(θ)=x/z"▶E2;
"TAN(θ)=y/x"▶E3;
"CSC(θ)=z/y"▶E4;
"SEC(θ)=z/x"▶E5;
"COT(θ)=x/y"▶E6;
""▶E7;
""▶E8;
""▶E9;
""▶E0;
END;//End of Accounting routine.
//-------------------------------------
//lib==4 is the link to Economic.
IF lib==4 THEN
"C=A+B"▶E1;
"C=A+B"▶E2;
"C=A+B"▶E3;
"C=A+B"▶E4;
"C=A+B"▶E5;
"C=A+B"▶E6;
"C=A+B"▶E7;
"C=A+B"▶E8;
"C=A+B"▶E9;
"C=A+B"▶E0;

PRINT();//This PRINT(); clears previous stuff to prevent it from being printed with current stuff.
//below Equ.s are printed on the screen along with
//description of variables used in the Equ.s
PRINT("
  Instructions re: Equations 
  ---------------------------------------
 Variables used in the Equ.s
   var1 = Flux Density
   var2 = Flux,        
   var3 = Magnetizing Force   
   var4 = Permeability of Material
   var5 = constant  = 1.2566ᴇ−6
   var6 = Relative Permeability 
   var7 = mmf");
END;//End of el==4 Economic routine.

//-----------------------------------------------
//lib==5 is the link of Next Category
IF lib==5 THEN
"C=A+B"▶E1;
"C=A+B"▶E2;
"C=A+B"▶E3;
"C=A+B"▶E4;
"C=A+B"▶E5;
"C=A+B"▶E6;
"C=A+B"▶E7;
"C=A+B"▶E8;
"C=A+B"▶E9;
"C=A+B"▶E0;

PRINT();
//below Equ.s are printed on the screen along with
//description of variables used in the Equ.s
PRINT("
  Variable defination
  ---------------------------------------
 Variables used in the Equ.s
   A = Flux Density
   B = Flux,        
   C = Magnetizing Force   
   var4 = Permeability of Material
   var5 = constant  = 1.2566ᴇ−6
   var6 = Relative Permeability 
   var7 = mmf");
END;//End of el==5 routine.

END;//Terminates program.

BM
Find all posts by this user
Quote this message in a reply
02-24-2020, 08:11 AM
Post: #2
RE: Library Tutorial
Thanks, is a big base to prepare a personalized library
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)