"unmatch control word" error message
|
12-23-2013, 09:49 PM
Post: #1
|
|||
|
|||
"unmatch control word" error message
I am getting an "unmatch control word" error message, when I attempt to execute the subroutine "InputPgm();" that is not part of my main file "WindChillPgm()". The subroutine has an input statement in it. Does anyone have a clue as to what this error message is?
Code: DegF;Mph;wct;wcto;ft; Code: EXPORT InputPgm() rcf |
|||
12-23-2013, 10:32 PM
(This post was last modified: 12-23-2013 10:35 PM by Han.)
Post: #2
|
|||
|
|||
RE: "unmatch control word" error message
Is the error message appearing during a "Check" or while exiting the source file? Or is it appearing while running the program?
Graph 3D | QPI | SolveSys |
|||
12-23-2013, 11:19 PM
Post: #3
|
|||
|
|||
RE: "unmatch control word" error message
You appear to be using the same input variables DegF and Mph also as your reset values. I'm not sure you can do that. Normally this is just a numeric value, such as zero.
|
|||
12-23-2013, 11:42 PM
(This post was last modified: 12-23-2013 11:55 PM by Damien.)
Post: #4
|
|||
|
|||
RE: "unmatch control word" error message
And if you had WindChillIntroDisplay(DegF,Mph) subroutine in your code ?
Code: WindChillIntroDisplay(DegF,Mph); Code: DegF,Mph,wct,wcto,ft; // local vars used You declare a function, you call it, but it does not exist ... Regards, Damien. |
|||
12-24-2013, 02:02 AM
Post: #5
|
|||
|
|||
RE: "unmatch control word" error message
(12-23-2013 10:32 PM)Han Wrote: Is the error message appearing during a "Check" or while exiting the source file? Or is it appearing while running the program? Han; It occurs when I execute the WindChillPgm program. I went back and checked the subroutine and found a syntax error. I cleared that by inserting in the InputPgm(),DegF,Mph in the parenthesis of the subroutine. Next I got an "invalid input" error message. Went to the "WindChillPgm", and added DegF,Mph in the parenthesis of that InputPgm() statement. Now I have no errors in either program, but the values I enter into the INPUT statement, are not being returned to the main "WindChillPgm". Actually, I'm not sure how to get the variables back to the main program. I tried {DegF,Mph}:=InputPgm(DegF,Mph); in the main program but that gave me an invalid information(green i) input error as soon as I hit the check button, but it did allow me to exit the program and run it again. When I ran it, it gave me an error "bad argument type", and dumped me out of the program. Hope this helps. I'm still curious as to what "unmatch control word" is. rcf |
|||
12-24-2013, 02:10 AM
Post: #6
|
|||
|
|||
RE: "unmatch control word" error message
(12-23-2013 11:19 PM)Michael de Estrada Wrote: You appear to be using the same input variables DegF and Mph also as your reset values. I'm not sure you can do that. Normally this is just a numeric value, such as zero. Michael; Yes, I am. If I put the "InputPgm()" in the same file as the "WindchillPgm()", it is allowed. What it does is loads my previous entered values into the 2 variables. That way, I only have to change 1 value, if the other value has not changed. rcf |
|||
12-24-2013, 02:25 AM
Post: #7
|
|||
|
|||
RE: "unmatch control word" error message
[quote='Damien' pid='1268' dateline='1387842170']
And if you had WindChillIntroDisplay(DegF,Mph) subroutine in your code ? Code: WindChillIntroDisplay(DegF,Mph); Code: DegF,Mph,wct,wcto,ft; // local vars used You declare a function, you call it, but it does not exist ... Regards, Damien. Damien; WindChillIntroDisplay(DegF,Mph) is not the problem. That subroutine only takes inputs and displays the 2 passed values DegF and Mph. What I am attempting to do is code in a conventional programming style, and have a subroutine create 2 new values and then pass them back to the main program "WindChillPgm();" so I can then pass them to another subroutine that is not part of the main program. I appear to have the syntax incorrect in getting the values back to the main program, Possibly you, Han, or Michael can help with that. Thanks rcf |
|||
12-24-2013, 03:47 AM
(This post was last modified: 12-24-2013 04:14 AM by Han.)
Post: #8
|
|||
|
|||
RE: "unmatch control word" error message
(12-24-2013 02:02 AM)Bob Frazee Wrote: Han; So you changed the how the program InputPgm was defined from InputPgm() -- no arguments -- to InputPgm(DegF, Mph) which takes two arguments. Did you realize that DegF and Mph as used are now also a local variable to the InputPgm, and distinct from the non-exported global variables of the same name? Quote:Next I got an "invalid input" error message. Well of course you would. You just changed the how InputPgm was defined, so that it now requires two input values. The program that called InputPgm was called as: InputPgm() -- without arguments -- so that is why you got the invalid input error. Quote:Went to the "WindChillPgm", and added DegF,Mph in the parenthesis of that InputPgm() statement. Now I have no errors in either program, but the values I enter into the INPUT statement, are not being returned to the main "WindChillPgm". Because you created an instance of local variables in InputPgm having the same name as global variables that you declared at the top of your source file. Local variables have highest priority in the case of variables of the same name but of different types overlapping in scope. Quote:Actually, I'm not sure how to get the variables back to the main program. I tried {DegF,Mph}:=InputPgm(DegF,Mph); in the main program but that gave me an invalid information(green i) input error as soon as I hit the check button, but it did allow me to exit the program and run it again. When I ran it, it gave me an error "bad argument type", and dumped me out of the program. Hope this helps. I'm still curious as to what "unmatch control word" is. InputPgm was not coded to return anything! Moreover, programs can only return a single object. So if you want multiple results returned, you must return a list containing each result. This list object must then be saved under a single variable within the calling program. You are completely misusing variables. You declared several non-exported global variables: Code: DegF;Mph;wct;wcto;ft; Code: WindChillIntroDisplay(DegF,Mph); Code:
None of your subroutines should need to pass global variables around. That would defeat the purpose of global variables. You simply declare them at the top and then just use them just like you would use any of the upper case variables A through Z. So WindChillIntroDisplay and all other programs should only be called (and defined) without arguments unless you are passing values not stored in a global variable. Graph 3D | QPI | SolveSys |
|||
12-24-2013, 08:44 PM
Post: #9
|
|||
|
|||
RE: "unmatch control word" error message
Han;
Here's the code(This code does what I want). //Variables... DegF;Mph; //List... DegfMph; WindChillIntroDisplay(); InputPgm(); EXPORT WindChillPgm() BEGIN STARTVIEW(-1,1); WindChillIntroDisplay(DegF,Mph); FREEZE; DegfMph:=InputPgm(DegF,Mph); DegF:=DegfMph(1); Mph:=DegfMph(2); STARTVIEW(-1,1); WindChillIntroDisplay(DegF,Mph); FREEZE; END; EXPORT WindChillIntroDisplay(DegFF,Mphh) BEGIN TEXTOUT("1: DegF= "+DegFF,-15,9); TEXTOUT("2: Mph= "+Mphh,-15,7); END; EXPORT InputPgm(DegF,Mph) BEGIN INPUT({DegF,Mph},"Input Values",{"DegF= :","Mph= :"},{"Air Temperature (-45 to 40 °F)","Wind Speed (3 to 60 Mph)"},{DegF,Mph}); RETURN {DegF,Mph}; END; These are 3 separate files in program memory, WindChillPgm(), InputPgm(), and WindChillIntroDisplay(). Right now, I'm feeling really dense. I would hate to admit how many hours I have spent on this, it's something I should have caught a long time ago. I was passing 2 individual values, DegF and Mph, to InputPgm(), and then passing them back as a LIST, and I wondered why I couldn't see them(duh...). So, I created a new variable "DegfMph" which is a LIST(created by InputPgm), then extracted the individual values. WindChillPgm() is where I start the program. I branch to WindChillIntroDisplay(DegF,Mph) to display whatever is presently in variables DegF and Mph. I then branch to InputPgm(DegF,Mph) to create new values for DegF and Mph. I then pass those 2 values back into WindChillPgm(DegF,Mph) as a LIST, extract the 2 values, then I pass them to WindChillIntroDisplay(DegF,Mph), which displays the new values. I am still searching for the answer to my original question as to what is "unmatch control word" error message. Many thanks for your input. rcf |
|||
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:
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 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 5 Guest(s)