This is a small App I created to familiarize myself with the operation of Apps. I used the Solve App as my template. The following is my code:
Code:
//Variables...
DegF;Mph;wct;wcto;ft;
WindChillIntroDisplay();
InputPgm();
FrostBiteEqn();
WindChillEqn();
OutputPgm();
EXPORT WindChillApp()
BEGIN
END;
VIEW "Start Windchill",START()
BEGIN
LOCAL K;
REPEAT
STARTVIEW(-1,1);
WindChillIntroDisplay();
FREEZE;
REPEAT
WAIT(1);
GETKEY▶K;
UNTIL K>−1;
IF K==42 OR K==43 THEN
InputPgm();
END;
IF K==30 THEN
WindChillEqn();
FrostBiteEqn();
STARTVIEW(-1,1);
OutputPgm();
//FREEZE;
WAIT(0);
END;
UNTIL K==4;
MSGBOX("test1");
STARTVIEW(-4,0);
END;
WindChillIntroDisplay()
BEGIN
TEXTOUT("1: DegF= "+DegF,-15,9);
TEXTOUT("2: Mph= "+Mph,-15,7);
TEXTOUT("Enter: Calculate WindChill",-15,1);
TEXTOUT("Esc=Quit",-15,-1);
END;
InputPgm()
BEGIN
INPUT({DegF,Mph},"Input Values",{"DegF= :","Mph= :"},{"Air Temperature (-45 to 40 °F)","Wind Speed (3 to 60 Mph)"},{DegF,Mph});
END;
FrostBiteEqn()
BEGIN
//LOCAL tmp;
// Could not get the following equation
// to work properly
//24.5*(.667*10*Mph*(8/5)+4.8)+2111▶tmp
//tmp*(4.8-(DegF-32)*(5/9))^(1.668)▶ft
//round(ft,0)▶ft
//Calculate frostbite time
CASE
IF DegF≤-45 AND Mph≥12 THEN 5▶ft END;
If DegF≤-45 and Mph≥0 Then 10▶ft END;
If DegF≤-40 and Mph≥14 Then 5▶ft END;
If DegF≤-40 and Mph≥0 Then 10▶ft END;
If DegF≤-35 and Mph≥17 Then 5▶ft END;
If DegF≤-35 and Mph≥7 Then 10▶ft END;
If DegF≤-35 and Mph≥0 Then 30▶ft END;
If DegF≤-30 and Mph≥21 Then 5▶ft END;
If DegF≤-30 and Mph≥7 Then 10▶ft END;
If DegF≤-30 and Mph≥0 Then 30▶ft END;
If DegF≤-25 and Mph≥26 Then 5▶ft END;
If DegF≤-25 and Mph≥9 Then 10▶ft END;
If DegF≤-25 and Mph≥0 Then 30▶ft END;
If DegF≤-20 and Mph≥37 Then 5▶ft END;
If DegF≤-20 and Mph≥12 Then 10▶ft END;
If DegF≤-20 and Mph≥0 Then 30▶ft END;
If DegF≤-17 and Mph≥35 Then 5▶ft END;
If DegF≤-15 and Mph≥42 Then 5▶ft END;
If DegF≤-15 and Mph≥16 Then 10▶ft END;
If DegF≤-15 and Mph≥45 Then 30▶ft END;
If DegF≤-12 and Mph≥45 Then 5▶ft END;
If DegF≤-10 and Mph≥57 Then 5▶ft END;
If DegF≤-10 and Mph≥22 Then 10▶ft END;
If DegF≤-10 and Mph≥0 Then 30▶ft END;
If DegF≤-5 and Mph≥33 Then 10▶ft END;
If DegF≤-5 and Mph≥7 Then 30▶ft END;
If DegF≤-2 and Mph≥35 Then 10▶ft END;
If DegF≤0 and Mph≥54 Then 10▶ft END;
If DegF≤0 and Mph≥12 Then 30▶ft END;
If DegF≤2 and Mph≥55 Then 10▶ft END;
If DegF≤2 and Mph≥15 Then 30▶ft END;
If DegF≤5 and Mph≥28 Then 30▶ft END;
If DegF≤7 and Mph≥30 Then 30▶ft END;
If DegF≤10 and Mph≥52 Then 30▶ft END;
If DegF≤12 and Mph≥55 Then 30▶ft END;
" NOT LIKELY"▶ft;
END;
END;
WindChillEqn()
BEGIN
//New WindChill Equation
35.74+.6215*DegF−35.75*Mph^.16+.4275*DegF*Mph^.16▶wct;
round(wct,0)▶wct;
//Old WindChill Equation(Prior to 2001)
.0817*(3.71*Mph^.5+5.81-.25*Mph)*(DegF-91.4)+91.4▶wcto;
round(wcto,0)▶wcto;
END;
OutputPgm()
BEGIN
TEXTOUT("DegF= "+DegF,-15,9);
TEXTOUT("Mph= "+Mph,-15,7);
TEXTOUT("New WindChill= "+wct,-15,5);
TEXTOUT("Old WindChill= "+wcto,-15,3);
TEXTOUT("Frostbite,≤min "+ft,-15,1);
TEXTOUT("Enter=Back",-15,-1);
END;
Questions:
EXPORT WindChillApp()
BEGIN
END;
What is intended to go between the BEGIN and END?
//FREEZE;
WAIT(0);
If I uncomment FREEZE; and comment out WAIT(0); why does the program blow right through the FREEZE instruction?
MSGBOX("test1");
STARTVIEW(-4,0);
On exiting the App, If I comment out MSGBOX("test1"); why does the program blow right through the STARTVIEW(-4,0); instruction, if I use the "Start" soft menu on the emulator Application Library screen? Otherwise it operates the way I want it to.
Anomilies:
When saving the App from the connectivity kit to the emulator, why must I hit the save icon at least 2 times to get it to save my changes to the emulator?
Thanks for any information you can provide.
rcf