Post Reply 
"unmatch control word" error message
12-25-2013, 12:53 AM (This post was last modified: 12-25-2013 02:58 AM by Han.)
Post: #10
RE: "unmatch control word" error message
Code:

//Variables...
DegF;Mph;

// subroutines
WindChillIntroDisplay();
InputPgm();


// main program
EXPORT WindChillPgm()
BEGIN
  WindChillIntroDisplay();
  WAIT(1);
  InputPgm();
  WindChillIntroDisplay();
END;


// subproutine
WindChillIntroDisplay()
BEGIN
  RECT();
  TEXTOUT_P("1: DegF= "+DegF,0,0);
  TEXTOUT_P("2: Mph= "+Mph,0,20);
  FREEZE;
END;


// subroutine
InputPgm()
BEGIN
  INPUT(
    {DegF,Mph},
    "Input Values",
    {"DegF= :","Mph= :"},
    {"Air Temperature (-45 to 40 °F)","Wind Speed (3 to 60 Mph)"},
    {DegF,Mph}
  );
END;

By combining the source files into one, you don't need local variables, as shown above. You also don't need to EXPORT the subprograms that could possibly be misused by users of your program, and it also does not clutter up the program catalogue. This benefit comes at the cost of having everything in one file -- not a huge deal if you program on a PC/emulator and then transfer to the calculator once all is done.

The only things I think you may want to change is to use different names for local variables and global variables even if they are to store the same value, and using TEXTOUT_P instead of TEXTOUT (the former uses pixel coordinates whereas the latter uses the plotter coordinates, which may change when exploring plots).

Spacing will help with legibility and organization of code.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: "unmatch control word" error message - Han - 12-25-2013 12:53 AM



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