Go to Post The part I like best is your method of transfering the torque via the balls. Very elegant. - Joe Johnson [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
  #16   Spotlight this post!  
Unread 02-12-2003, 14:37
ErichKeane ErichKeane is offline
Registered User
FRC #3210
Team Role: Mentor
 
Join Date: Nov 2003
Rookie Year: 2004
Location: Hillsboro, OR
Posts: 113
ErichKeane is just really niceErichKeane is just really niceErichKeane is just really niceErichKeane is just really niceErichKeane is just really nice
Send a message via AIM to ErichKeane
Re: Space Limit--What is expendable?

Quote:
Originally Posted by Dave Flowerday
Actually it'd be better to use this:
Code:
signedpwm01 = (char) pwm01 - 128;
A signed char can range from -128 to 127. Thus, if you subtract 128 it will give you a reasonable value for any value of pwm01. If you subtract 127, then you get into a problem if pwm01 = 255. 255-127 = 128, however a signed char cannot be 128, and will actually end up being -128! (This is a side effect of the way a computer stores a negative number). Realistically, pwm01 isn't supposed to be larger than 254, but in software it's usually better to make something work for all cases rather than assume that certain cases won't occur.

Ah, correct on that one. The reason i put -127 is it correctly centers it every time, and i have a cleaning function run that basically limits the pwm values before hand, so 254 is the max necessary. The other thing you could do would be to use INT's, which allows a large amount more of integer mathematics, another thing my team found necessary.
  #17   Spotlight this post!  
Unread 02-12-2003, 17:01
josh_johnson josh_johnson is offline
Registered User
#1020 (Indiana Prankmonkeys)
 
Join Date: Nov 2002
Location: Muncie, IN
Posts: 58
josh_johnson is an unknown quantity at this point
Send a message via AIM to josh_johnson Send a message via Yahoo to josh_johnson
Re: Space Limit--What is expendable?

Quote:
Originally Posted by Anthony Kesich
On that note, does anybody know if you can nest the ?: operator? i.e. x=(condtion 1) ? 1 : (condition 2) ? 2 : (condition 3) ? 3 : ... (condition n) ? n : 0
yes, you can nest the ?: operator, although i am not certain of the order of operations so you might want to type it like

x=(condition1 ? 1 : (condition2 ? 2 : (condition3 ? 3 : ...(condition n ? n : 0)...))

also a range of case statements cannot be used as in PBasic however the following is a way to simulate this.


switch(statement) {
case 1:
case 2:
case 3:
doSomething();
break;
case 4:
case 5:
case 6:
doSomethingElse();
break;
}


However this would not be practical for a very large range of values.

Also, if the compiler compiles the sane way as the C compiler I have studied, a switch/case statement uses up more code space than if/else statements, especially when there is a large range of skipped values such as. ..


switch(statement) {
case 1:
doSomething();
break;
case 1000000:
doSomethingElse();
break;
}


Switch/case statements are quicker than several if/else statements though because it jumps to a calculated address rather than having to make many comparisons, but this will not be noticeable if there are only a few choices.
__________________
5! * (4! - 3! - 1!) / 2!

Last edited by josh_johnson : 02-12-2003 at 17:06. Reason: fixed formatting
  #18   Spotlight this post!  
Unread 04-12-2003, 16:44
Rickertsen2 Rickertsen2 is offline
Umm Errr...
None #1139 (Chamblee Gear Grinders)
Team Role: Alumni
 
Join Date: Dec 2002
Rookie Year: 2002
Location: ATL
Posts: 1,421
Rickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant future
Send a message via AIM to Rickertsen2 Send a message via Yahoo to Rickertsen2
Re: Space Limit--What is expendable?

Quote:
Originally Posted by Random Dude
Whats wrong with signed chars? I've converted all my PWM signals to signed to simplify the math.
I have done the same. The reason i specified unsigned chars is bc they take more instructions to process. This translates into larger programs and slower execution times. If you arn't having problems with speed and or space i wouldn't worry about it. If you want to demonstrate this for yourself, write a program that does some signed and unsigned operations, and then look at the assembly code.
__________________
1139 Alumni
  #19   Spotlight this post!  
Unread 06-12-2003, 21:37
ErichKeane ErichKeane is offline
Registered User
FRC #3210
Team Role: Mentor
 
Join Date: Nov 2003
Rookie Year: 2004
Location: Hillsboro, OR
Posts: 113
ErichKeane is just really niceErichKeane is just really niceErichKeane is just really niceErichKeane is just really niceErichKeane is just really nice
Send a message via AIM to ErichKeane
Re: Space Limit--What is expendable?

Quote:
Originally Posted by Rickertsen2
I have done the same. The reason i specified unsigned chars is bc they take more instructions to process. This translates into larger programs and slower execution times. If you arn't having problems with speed and or space i wouldn't worry about it. If you want to demonstrate this for yourself, write a program that does some signed and unsigned operations, and then look at the assembly code.
Technically yes, you are correct, the difference between signed and unsigned mathematics is a little more processor intensive. It does not take more space though in the memory banks at all afaik. I believe all it does is use an unsigned Char, and then subtract the 127/128 or whatever in implementaiton. The difference is so minimal between the two, i never saw it as a problem.

I did a few things that helped me save a huge amount of space.
1- I reverted to completely integer mathematics, as opposed to floating point mathematics, which are horrid!
2- got rid of all unnecessary portions of the default code. That removed a large amount of the space (about 12% of our programming memory!), and left a good amount of the programming to me instead of some default setup.
3- Got rid of that printf library. It is easily the worst written print library i have seen in ages. Instead, my team is using the printword and printbyte and etc library in the utilities.

You guys have been a great help, keep the good posts comming.
  #20   Spotlight this post!  
Unread 08-12-2003, 18:56
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,906
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Space Limit--What is expendable?

The IFI_Loader will also give you the space used.
Just hit return when IFI_Loader is active and you'll get a report in the bottom message bar.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
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
St. Louis anyone? Jeremy_Mc Regional Competitions 8 07-02-2003 12:06
Slightly humorous story about global warming & space explor. archiver 2001 3 24-06-2002 04:01
The 'Big Picture' regarding regional space.. archiver 2000 1 23-06-2002 23:58
KSC Results archiver 2000 2 23-06-2002 22:19
CD forum don't have space for more pictures? Ken Leung General Forum 7 10-04-2002 23:41


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

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