|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#4
|
|||
|
|||
|
Re: Ahh! Program trick confusing!
Posted by Travis Hoffman at 03/18/2001 9:00 AM EST
Engineer on team #48, Delphi E.L.I.T.E., from Warren G. Harding High School and Delphi Automotive Systems . In Reply to: Ahh! Program trick confusing! Posted by Gui Cavalcanti on 03/17/2001 1:01 PM EST: : OK... wait. I've just read that entire segment dedicated to the extended programming trick that involves multiple programs.. but i'm confused. Do you add subroutines before or after the "RUN" command line in your programs? For example, i'll give you the following.. It depends on your definition of "subroutine". All subroutines within a particular program called with the GOSUB instruction from the program body must be placed AFTER the RUN statement in that program: 'Program 1 body pump = on GOSUB Pumptimer RUN 2 'Pumptimer subroutine Pumptimer: 'pumptimer code RETURN If, by "subroutine", you are instead referring to a smaller piece of your original unmodified program body that you placed in one of the subprograms of the new method, then this code should go BEFORE the RUN statement, just like any other regular code: Original Program: :Initialization Code MainLoop: :SERIN :LIGHT CODE RIVE CODE:LIFT CODE :SEROUT GOTO MainLoop ************************************* New Method: rogram 0:Initialization Code :RUN Program 1 :------------ rogram 1:SERIN :LIGHT CODE :RUN Program 2 :------------ rogram 2 RIVE CODE:LIFT CODE :SEROUT :RUN PROGRAM 1 'Equivalent to GOTO MainLoop :------------ You can see how program execution flows in exactly the same manner as the original program. The only difference is you have boatloads more program space to work with ![]() Also, shouldn't PROGRAM 0 be your first program? I could be wrong, but I thought it had to be. Program 0 is where you modify the Basic Stamp directive to include the names of programs 1-7. I have my initialize code in program 0. I then loop back to program 1 at the end of my highest-numbered program. Travis : Program 1: : Initialization : SERIN command : light subroutine : RUN Program 2: : ----- : Program 2: : Initialization : Major subroutines : RUN Program 3: : ----- : Program 3: : Initialization : minor subroutine : SEROUT command : RUN Program 1: : ----- : Is that right, or did I really screw something up? : -Gui Cavalcanti : 422 (Mech Tech) |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 2-week FIRST summer program @ WPI | ColleenShaver | General Forum | 20 | 31-05-2009 03:02 |
| initialization program and speed controllers | rosebud | Programming | 15 | 05-10-2004 03:35 |
| Fried program slots? | Jeff Waegelin | Programming | 18 | 19-03-2003 18:08 |
| Credits for FIRST program. | archiver | 2000 | 6 | 24-06-2002 00:16 |
| An invitation for HS Juniors | archiver | 2000 | 0 | 23-06-2002 22:51 |