Go to Post p.s. It's 10:20 PM. Santa hasn't come yet, but Dave Lavery and the GDC brought me a headache for Christmas! - Petey [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
  #1   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 Gregory Ross at 03/18/2001 2:15 AM EST


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


In Reply to: Ahh! Program trick confusing!
Posted by Gui Cavalcanti on 03/17/2001 1:01 PM EST:



I can see a possible problem or two with your pseudo program.

Remember, every time you "run" one of the programs in your BASIC Stamp project, it is run from the beginning -- including any initialization code. This will happen every time through the main loop -- approximately 40 times per second. More than likely, this is not what you want to have happen.

Obviously, as with any programming problem, there will be more than one way to overcome it.

Probably the easiest way (and not the way I did it when I split up our program) is something like this:

Program 1:
Initialize
RUN Program 2
-----
Program 2:
SERIN command
perform light routine
perform compressor control
RUN Program 3
-----
Program 3:
perform steering functions
RUN Program 4
-----
Program 4:
perform lift control functions
RUN Program 5
-----
Program 5:
perform bridge balance function
SEROUT command

RUN Program 2
-----


Note: In the initialization, everything needed for all programs should be initialized. The only exception is anything that needs to be initialized in EEPROM (which can be accessed only from its own program.) If you need to initialize anything in EEPROM, I would suggest something like:

Program 1:
Initialize
RUN Program 2
-----
Program 2:
if first time then Initialize
SERIN command
perform light routine
perform compressor control

RUN Program 3
-----
Program 3:
if first time then Initialize
perform steering functions
RUN Program 4
-----
Program 4:
if first time then Initialize
perform lift control functions
RUN Program 5
-----
Program 5:
if first time then Initialize
perform bridge balance function
SEROUT command

RUN Program 2
-----

You also need to remember that all of the variable space and all of scratchpad RAM is common between programs. You need to be sure to use the same variable definitions and scratchpad memory map in all your programs. The easiest way to do so is to declare all your data in an include file, and use the BASIC Stamp Preprocessor which I wrote to insert my include file into all my project files. I'm still not quite ready to formally release it, but if you are interested in beta testing it, let me know, and I will e-mail it to you.

Gregory Ross
Team 330, Beach Bots (Los Angeles Regional co-champs!)





: 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..

: 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 00:10.

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