Go to Post If you don't like contact, your robot is not built well enough. - sanddrag [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 14-01-2002, 15:20
Matt Reiland's Avatar
Matt Reiland Matt Reiland is offline
'The' drive behind the drive
None #0226 (TEC CReW Hammerheads)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1999
Location: Troy Michigan
Posts: 712
Matt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond repute
PBasic Variable

When breaking a PBasic program into 'slots' are you required to declare the same 26 variables in each slot or are you able to declare different variables? After I split my program up and looked at the memory map, 1 of the slots has a different # of bytes free than the rest because of a different variable declaration but the program didn't bomb out on verification?

Any knowledge of this one?

Thanks
Matt
  #2   Spotlight this post!  
Unread 14-01-2002, 15:41
Joe Johnson's Avatar Unsung FIRST Hero
Joe Johnson Joe Johnson is offline
Engineer at Medrobotics
AKA: Dr. Joe
FRC #0088 (TJ2)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Raynham, MA
Posts: 2,648
Joe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond repute
Stop it you're scaring me!

What I am pretty sure about is that the physical RAM space is the same from slot to slot.

The problem is that your declarations really are just aliases for the the real RAM space.

If your declarations don't match, then the alias is pointing to a differen place in RAM.

This can really screw you up because a variable called Dog may actual be changing the variable you have been calling Cat in another program slot. This is a doubly bad event because Dog did not get the value you wanted AND Cat's value is trashed as well.

Bottom line:

Take pains to make sure your declarations match from program slot to programs slot.

Joe J.
  #3   Spotlight this post!  
Unread 15-01-2002, 08:55
Matt Reiland's Avatar
Matt Reiland Matt Reiland is offline
'The' drive behind the drive
None #0226 (TEC CReW Hammerheads)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1999
Location: Troy Michigan
Posts: 712
Matt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond repute
Thanks

Sounds lke one headache I could do without.
  #4   Spotlight this post!  
Unread 15-01-2002, 13:04
pbhack pbhack is offline
Registered User
#0278 (HERO)
 
Join Date: Jan 2002
Location: Orlando
Posts: 1
pbhack is an unknown quantity at this point
Lightbulb Could be done...but a lot of bookkeeping

I haven't done this, but this approach seems plausible...

1) Order variable declarations starting with global variables first.
2) For your own benefit, clearly mark the point of divergence where the variables (symbols) in each slot differ.
3) Consider all variables after the divergence to be "local"
4) In the "called" slot, make sure that you manually initialize the local vars.

Brent
Programming Mentor
Hero 278
  #5   Spotlight this post!  
Unread 15-01-2002, 13:16
Joe Johnson's Avatar Unsung FIRST Hero
Joe Johnson Joe Johnson is offline
Engineer at Medrobotics
AKA: Dr. Joe
FRC #0088 (TJ2)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Raynham, MA
Posts: 2,648
Joe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond repute
It is a headache but code space may drive you to it anyway...

Yes, it is a bother. But...

If you are out of code space it is an acceptable way out compared to just taking features out of your robot control.

It can be managed. we had 3 slots last year: Initialization, Get data & Arm calcs, and Wheel calcs & output data.

It worked okay, but sometimes we made mistakes from program to program and caused some subtle errrors. Very tricky to find if you are not aware of the possible problems.

Buyer beware!

Joe J.
Closed Thread


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 On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Obscure PBASIC for RoboEmu rbayer Programming 1 28-03-2003 23:57
PBasic 2.5 vs. 2.0 Anthony Kesich Programming 6 09-02-2003 22:06
PBasic Question Melissa H. Programming 28 17-11-2002 18:53
emulationFIRST (aka PBasic emulator) Matt Leese Programming 5 30-06-2002 12:06
Subtotaling in PBASIC? Ian W. Programming 17 02-02-2002 20:22


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

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