Run command... frightening

Posted by Gui Cavalcanti at 04/14/2001 11:15 AM EST

Student on team #422, Mech Tech, from Governor’s School (GSGIS) and Verizon.

All you programmers remember that old series of posts about the PBasic RUN command… Now, I tried this is a series of three programs to see if it would work, and nothing worked at all. The compiler would run through my program, then hit the run command and would stop on the word after it. Here’s an excerpt from my code:
(By the way, the STAMP FILES thing is the initialization, I couldn’t find the exact wording at the time of this message)

------------InitProg (Initialization and SERIN line—

{STAMP FILES InitProg, MainProg, SerOProg}

(Declare variables, constants, aliases)

(Initialize variables)

(Serial In line)

RUN MainProg

---------------------------MainProg (Main Program) —

{STAMP FILES InitProg, MainProg, SerOProg}

(Declare variables, aliases, constants)

(Main programming without gosubs)

RUN SerOProg

-----------------------------SerOProg (Serial Out) ----

{STAMP FILES InitProg, MainProg, SerOProg

(Declare variables, constants, aliases)

(SEROUT line)

RUN InitProg

Now, I know one problem here is that you are going back to initialization and your old variables would be rewritten automatically, so your initialization would have to be a separate program from the serial in line… but other than that, this doesn’t work at all. Could someone help me out here?

-Gui

Posted by Gregory Ross at 04/14/2001 11:18 PM EST

Engineer on team #330, Beach Bots, from Hope Chapel Academy and NASA/JPL.

In Reply to: Run command… frightening
Posted by Gui Cavalcanti on 04/14/2001 11:15 AM EST:

When you say “The compiler would run through my program”, do you mean when the program is being tokenized, or after the program has been tokenized and downloaded, and when the program is actually running?

If the former, what is the error message? If the latter, how do you know it is stopping on the statement after the run?

I’m guessing you mean the former, and the problem is that the symbol MainProg is not defined. It would be nice if the tokenizer created symbols that refer to your project programs, but it doesn’t.

You need to either define

InitProg con 0
MainProg con 1
SerOProg con 2

or use

run 1
.
.
.
run 2
.
.
.
run 0

: All you programmers remember that old series of posts about the PBasic RUN command… Now, I tried this is a series of three programs to see if it would work, and nothing worked at all. The compiler would run through my program, then hit the run command and would stop on the word after it. Here’s an excerpt from my code:

: (By the way, the STAMP FILES thing is the initialization, I couldn’t find the exact wording at the time of this message)

: ------------InitProg (Initialization and SERIN line—

: {STAMP FILES InitProg, MainProg, SerOProg}

: (Declare variables, constants, aliases)

: (Initialize variables)

: (Serial In line)

: RUN MainProg

: ---------------------------MainProg (Main Program) —

: {STAMP FILES InitProg, MainProg, SerOProg}

: (Declare variables, aliases, constants)

: (Main programming without gosubs)

: RUN SerOProg

: -----------------------------SerOProg (Serial Out) ----

: {STAMP FILES InitProg, MainProg, SerOProg

: (Declare variables, constants, aliases)

: (SEROUT line)

: RUN InitProg

: –

: Now, I know one problem here is that you are going back to initialization and your old variables would be rewritten automatically, so your initialization would have to be a separate program from the serial in line… but other than that, this doesn’t work at all. Could someone help me out here?

: -Gui