Go to Post My hammer is my therapist, my weapon against bent metal, unwilling bolts, and tall nails. - Morgan Gillespie [more]
Home
Go Back   Chief Delphi > Old Forum Archives > 2001
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Spotlight this post!  
Unread 24-06-2002, 02:26
archiver archiver is offline
Forum Archival System
#0047 (ChiefDelphi)
 
Join Date: May 2001
Location: Pontiac, MI
Posts: 21,214
archiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond repute
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)


__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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


All times are GMT -5. The time now is 09:24.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi