Go to Post I told myself I'd stay out of the obsession this year, but I couldn't resist... - Grant Cox [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 25-10-2004, 21:59
Anthony Kesich's Avatar
Anthony Kesich Anthony Kesich is offline
Programmer Turned Engineer
AKA: SonKenshin
#1097 (Site 3 Engineernig)
Team Role: Leadership
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Sacramento, CA
Posts: 186
Anthony Kesich has a spectacular aura aboutAnthony Kesich has a spectacular aura about
Send a message via AIM to Anthony Kesich
Has anyone had lack of processing power?

Reading through the Programming thread, I have come across many a post referring to avoiding doubles and square roots and standard Math.h functions since the PIC is an 8-bit processor. I remember this was a big thing before the start of last season too. We even tried to rewrite the Math.h to not use things like sqrts and the like. And yes, I do understand why those things were avoided since they take more power since an 8-bit processor will use software to do 64-bit math instead of hardware.

Here's my question though. Has anyone actually had problems with processing power on the PIC? I mean, have you had dropped packets due to the processing cycle taking too long or something along those lines? 26.2ms is quite a long time for a processor.
__________________
C is screwing up my English--I'm ending all my sentences in semi-colons;

Horray for most things! -George Carlin

"Sure, I'll play rugby. Besides, I have a lot of experience running from really big guys who want to cream me." -Me, Freshman year
  #2   Spotlight this post!  
Unread 26-10-2004, 09:19
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,785
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: Has anyone had lack of processing power?

Most of the problems with the processor keeping up that I've run across with various teams have been due to inefficient and bloated code. They more often run out of programming space than processor time. The most common exception has been bloated interrupt handlers causing multiple interrupts to be missed. The code problems are to be expected with people learning to program for the first time and attempting to implement complex equations from their math textbook.
The cautions are more directed at the neophytes than experienced programmers.

I did some measurements last Fall on the Robovation (formerly EDU) controller and came up with:
v45% more program space than the equivalent operation using integer math is what’s roughly required for simple floating-point operations (e.g., a=10.5*2.3 vs i=105*23)
v22% more time is required for equivalent float vs. integer operations

I no longer remember the details as to what percentage of program space was due to a one time floating point library and what each additional statement demands. It just takes a minute or two to run the test though.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #3   Spotlight this post!  
Unread 26-10-2004, 11:09
Kris Verdeyen's Avatar
Kris Verdeyen Kris Verdeyen is offline
LSR Emcee/Alamo Game Announcer
FRC #0118 (Robonauts)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 2001
Location: Houston, TX
Posts: 697
Kris Verdeyen has a reputation beyond reputeKris Verdeyen has a reputation beyond reputeKris Verdeyen has a reputation beyond reputeKris Verdeyen has a reputation beyond reputeKris Verdeyen has a reputation beyond reputeKris Verdeyen has a reputation beyond reputeKris Verdeyen has a reputation beyond reputeKris Verdeyen has a reputation beyond reputeKris Verdeyen has a reputation beyond reputeKris Verdeyen has a reputation beyond reputeKris Verdeyen has a reputation beyond repute
Re: Has anyone had lack of processing power?

We had some issues keeping track of an encoder we used to close the loop around our steering control. It got to be very resource-intensive to count every edge transition, so we modified the code to only count every fourth encoder transition, which worked fine.

The problem, as Mark noted, is that the program hasn't returned from the interrupt service routine by the time that another interrupt comes along. This causes the processor to miss a count, which over time will lead to a large position error.

This will be the main type of problem that you'll see, especially if you try to close any high speed loops.
__________________
...Only a few people are awake and they live in a state of constant total amazement. -JP Shanley, Joe vs. the Volcano

Last edited by Kris Verdeyen : 26-10-2004 at 11:10. Reason: credit where it's due...
  #4   Spotlight this post!  
Unread 26-10-2004, 17:16
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: Has anyone had lack of processing power?

Quote:
Originally Posted by Kris Verdeyen
We had some issues keeping track of an encoder we used to close the loop around our steering control. It got to be very resource-intensive to count every edge transition, so we modified the code to only count every fourth encoder transition, which worked fine.

The problem, as Mark noted, is that the program hasn't returned from the interrupt service routine by the time that another interrupt comes along. This causes the processor to miss a count, which over time will lead to a large position error.

This will be the main type of problem that you'll see, especially if you try to close any high speed loops.
Nested interrupts are not a problem if you take special consideration and re-enable the GIE flag. The processor has a 31 level deep hardware stack. As long as you don't overflow that you are fine. The problem is not with nested interrupts but in too many of them overflowing the stack. Note: the way the default code it setup, nested interrupts will be ignored. You will have to rewrite it to determine the source of the interrupt, clear the appropriate flag, reset the GIE flag, and then do you interrupt processing. Just be careful to avoid odd race condiditions etc. Everything I said above applies only to low priority interrupts. If you do not know the difference then you are using low priority interrupts and everything i jsut said applies.
__________________
1139 Alumni

Last edited by Rickertsen2 : 26-10-2004 at 17:21.
  #5   Spotlight this post!  
Unread 26-10-2004, 17:07
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: Has anyone had lack of processing power?

Quote:
Originally Posted by Mark McLeod
Most of the problems with the processor keeping up that I've run across with various teams have been due to inefficient and bloated code. They more often run out of programming space than processor time. The most common exception has been bloated interrupt handlers causing multiple interrupts to be missed. The code problems are to be expected with people learning to program for the first time and attempting to implement complex equations from their math textbook.
The cautions are more directed at the neophytes than experienced programmers.

I did some measurements last Fall on the Robovation (formerly EDU) controller and came up with:
v45% more program space than the equivalent operation using integer math is what’s roughly required for simple floating-point operations (e.g., a=10.5*2.3 vs i=105*23)
v22% more time is required for equivalent float vs. integer operations

I no longer remember the details as to what percentage of program space was due to a one time floating point library and what each additional statement demands. It just takes a minute or two to run the test though.
Where did you come up with these figures? The time difference btw float and fixed/decimal depends on the operation. For some operations its not that great. For others it is very large. Same with the instruction cycles.
__________________
1139 Alumni
  #6   Spotlight this post!  
Unread 26-10-2004, 21:57
Unsung FIRST Hero
Matt Leese Matt Leese is offline
Been-In-FIRST-Too-Long
FRC #1438 (The Aztechs)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1998
Location: Long Beach, CA
Posts: 937
Matt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond repute
Send a message via AIM to Matt Leese
Re: Has anyone had lack of processing power?

Quote:
Originally Posted by Rickertsen2
Where did you come up with these figures? The time difference btw float and fixed/decimal depends on the operation. For some operations its not that great. For others it is very large. Same with the instruction cycles.
I haven't done any real investigating into this but I'm going to have to say that it is almost guaranteed that a floating point operation will take an order of magnitude longer than the corresponding integer operation. For processors with a floating point unit, floating point operations take significantly longer than integer operations. Given that the PIC has to emulate floating point operations, what may be a one cycle operation (say, adding two integers) may take many more cycles because of all the additional operations required to unpack the floating point, perform the operation, and then repeat it.

Floating point operations on this processor will take much longer than integer operations. However, this may or may not be significant depending on other factors.

Matt
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
Need way to fix power feed on OI Shu Song Electrical 11 25-04-2004 15:03
Operator Interface power ISSUE kacz100 Technical Discussion 11 27-02-2004 13:46
URGENT!! Need OI power brick specs for 7AM demo tomorrow!!! kmcclary Electrical 8 10-10-2002 10:56
power of globe motor with gear box? Ken Leung Motors 5 21-11-2001 13:43
Max mechanical power of motors, how is it useful? Ken Leung Motors 1 09-11-2001 14:15


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

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