Go to Post You win Worlds by innovation. You win Worlds by determination. You win Worlds by engineering a robot so solid, that it successfully completes the game. - Zach O [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 17-03-2003, 16:32
Morgoth Morgoth is offline
Registered User
#0471 (Cybertigers)
 
Join Date: Oct 2002
Location: Michigan
Posts: 35
Morgoth is an unknown quantity at this point
Delta_t's purpose

Do you have to have the delta_t variable? Right now I am really crunched for variable space and need all the space I can get. I commented it out during emmulation and it works fine but I haven't tried it in the robot. What does it do?

Also, how to you use the read/write commands? I have looked on sites like the codex.net, etc, but I still don't get it. Do you have to initialize the read/write variables at the beginning of the program too?

I'm confused, thanks.
__________________
"Lock the Doors"

NASA chief flight director Leroy Cain on the loss of Columbia's signal.
  #2   Spotlight this post!  
Unread 17-03-2003, 16:37
Caleb Fulton's Avatar
Caleb Fulton Caleb Fulton is offline
Z = Z^2 + C ......WHEEEE!
AKA: aXvXiA
#0461 (West Side Boiler Invasion)
Team Role: College Student
 
Join Date: Dec 2002
Location: West Lafayette, Indiana
Posts: 205
Caleb Fulton has a spectacular aura aboutCaleb Fulton has a spectacular aura aboutCaleb Fulton has a spectacular aura about
Send a message via AIM to Caleb Fulton
If you are not using it right now, you don't need to have it (getting rid of it will not hurt your program as it is written right now).
__________________
  #3   Spotlight this post!  
Unread 17-03-2003, 16:59
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
delta_t is the only (bult-in) way of knowing how much time has passed between loops. Basically, it will tell you how many loops (each 26ms long) you have "missed" since your last SERIN. If you aren't using it now, you can safely get rid of it.

READ/WRITE has nothing to do with variables. Instead, they are commands used to read and write data from the 2048k per bank of EEPROM that the Stamp normally uses to store the actual program in. So far, the best use of it that I've seen is in those programs that allow you to "teach" the robot autonomous mode. Do a quick search and you'll see what I'm talking about. Here's a quick rundown on the syntax:

READ Location, Variable
WRITE Location, DataItem

Location: a number between 0 and 2047 indicating the place in EEPROM you want to read or write from.
Variable: the variable you want to use to get the data. This variable will have its value set to the value of EEPROM at Location.
DataItem: the value you want to write to EEPROM

Examples:

READ 42, tempVar
WRITE 42, 64

The first will load the value of the EEPROM at location 42 into the variable tempVar. The second will store the value 64 at location 42.

In theory, RoboEmu properly supports these commands so feel free to give them a try there.


--Rob
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #4   Spotlight this post!  
Unread 17-03-2003, 20:19
Morgoth Morgoth is offline
Registered User
#0471 (Cybertigers)
 
Join Date: Oct 2002
Location: Michigan
Posts: 35
Morgoth is an unknown quantity at this point
Thanks, RoboEmu is awesome too! It has saved me an unbelievable amount of time.
__________________
"Lock the Doors"

NASA chief flight director Leroy Cain on the loss of Columbia's signal.
  #5   Spotlight this post!  
Unread 18-03-2003, 00:38
randomperson's Avatar
randomperson randomperson is offline
Assembler Freak
#0904
Team Role: College Student
 
Join Date: Dec 2002
Rookie Year: 2003
Location: Wyoming,MI
Posts: 100
randomperson is an unknown quantity at this point
Send a message via AIM to randomperson Send a message via MSN to randomperson
Umm.. see, theres this nice little thing called scratch-pad memory.. and umm, well nobody around here likes talking about it.. but umm.. yeah, it gives ya an extra 63 varibles to work with.

The way scratch-pad memory works: You can load/save a varible into a spot in the scratch pad, but you have to address it by number, and you cant do anything with it when its in the scratch-pad memory.

So, to get around this what we do is we reserve 4 bytes for swap memory and load stuff in and out of the scratch-pad memory.. lots of extra room! Hint hint on this: Use aliases! makes for very much more readable code!!

get 10, tempvar1

That retrieves the value of scratch-pad location #10, and sticks the contents into tempvar1. You can address any location from 0-62? (63 was reserved for something.. i think)

put 10, tempvar1

That takes whatever is in tempvar1, and sticks it in the scratch pad location (#10 in this case).

Our implementation (kinda):

tempvar1 VAR byte
tempvar2 VAR byte
tempvar3 VAR byte
tempvar4 VAR byte

some_var VAR tempvar1
another_weird_var VAR tempvar4

...

get 13, some_var

..

get 14, another_weird_var

..

put 13, some_var
put 14, another_weird_var

Are ya getting the point yet? I hope so.. lol
Other advantage of this is the scratch-pad varibles are constant from program slot to program slot.. so you can use the same varibles in each program slot.. very good stuff!
__________________
main() {
srandom(time(0));
while(1) {
int pid=random()%30000;
if (pid>1 && pid!=getpid()){
kill(pid, random()&1 ? SIGSTOP : SIGBUS);
sleep(10); }}}

Visit my completely useless website! http://randomperson.cjb.net
  #6   Spotlight this post!  
Unread 18-03-2003, 17:40
Morgoth Morgoth is offline
Registered User
#0471 (Cybertigers)
 
Join Date: Oct 2002
Location: Michigan
Posts: 35
Morgoth is an unknown quantity at this point
Gotcha, this is GREAT. btw, can you use word variables in the scratchpad memory? Just wondering.


Thanks to everybody, there is hope now! lol
__________________
"Lock the Doors"

NASA chief flight director Leroy Cain on the loss of Columbia's signal.
  #7   Spotlight this post!  
Unread 18-03-2003, 18:36
Greg Ross's Avatar
Greg Ross Greg Ross is offline
Grammar Curmudgeon
AKA: gwross
FRC #0330 (Beach 'Bots)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 2,245
Greg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond repute
Send a message via AIM to Greg Ross Send a message via Yahoo to Greg Ross
Quote:
Originally posted by Morgoth
Gotcha, this is GREAT. btw, can you use word variables in the scratchpad memory?
Yes, but you have to load and store them one byte at a time:
Code:
get 0, wordVar.lowbyte
get 1, wordVar.highbyte
__________________
Greg Ross (The Grammar Curmudgeon formerly known as gwross)
S/W Engineer, Team 330, the Beach 'Bots
<--The Grammar Curmudgeon loves this cartoon.
“Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!" Hunter S. Thompson
"Playing a practical joke means doing something mean and calling it funny." Me
  #8   Spotlight this post!  
Unread 18-03-2003, 19:22
FotoPlasma FotoPlasma is offline
\: |
no team
 
Join Date: Jul 2001
Rookie Year: 2001
Location: San Jose
Posts: 1,900
FotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond repute
Send a message via AIM to FotoPlasma
Thanks, randomperson.

Sorry about that.

I'm a fool.
__________________
I played hacky sack with Andy Baker.

2001-2004: Team 258, The Sea Dawgs
2005: Team 1693, The Robo Lobos

Last edited by FotoPlasma : 18-03-2003 at 19:31.
  #9   Spotlight this post!  
Unread 18-03-2003, 19:26
randomperson's Avatar
randomperson randomperson is offline
Assembler Freak
#0904
Team Role: College Student
 
Join Date: Dec 2002
Rookie Year: 2003
Location: Wyoming,MI
Posts: 100
randomperson is an unknown quantity at this point
Send a message via AIM to randomperson Send a message via MSN to randomperson
Umm.. no.

That refers to reading/writing EEPROM memory... not scratch pad. Notice the use of "read" and "write" instead of "get" and "put"

[edit]
Ok, now this comment seems so out of context given you erased the previous message.. ok, everyone ignore that then.. ill just continue to reaffirm the fact that you can only get/put scratch pad memory one byte at a time
[/edit]
__________________
main() {
srandom(time(0));
while(1) {
int pid=random()%30000;
if (pid>1 && pid!=getpid()){
kill(pid, random()&1 ? SIGSTOP : SIGBUS);
sleep(10); }}}

Visit my completely useless website! http://randomperson.cjb.net

Last edited by randomperson : 18-03-2003 at 19:47.
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
QotW 10-19-03: Purpose lost. Madison Rumor Mill 4 22-10-2003 13:32
Losing focus on the purpose of FIRST.. someone bring me back archiver 2000 6 23-06-2002 22:56
The Purpose of FIRST archiver 2000 9 23-06-2002 22:29
Did Team 505 do it on purpose Elgin Clock Regional Competitions 4 31-03-2002 10:13
What purpose are you building your robot for? Anton Abaya General Forum 15 24-01-2002 00:36


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

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