View Single Post
  #10   Spotlight this post!  
Unread 08-01-2004, 12:14
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Re: Time to feel stupid....

Quote:
Originally Posted by galewind
I suppose that what I'm getting at is --

Is it true that adding one block of code (obviously not an infinite loop, but, say, another case to a switch) to an already "reasonably" sized Default_Routine will not force you to change the timings of your loop counters as drastically as before?
Quite correct. You can now have many pages of code which will execute with no obvious effect of the system, if it is done carefully.

The easiest trap to fall into is to use floating point arithmetic or calls to the math.h libraries. Since the PIC is a integer machine, a floating point operation can cause literally thousands of machine operations to be performed. These operations take time and time can add up.

Even some integer operations can take longer than you think. Since the PIC has no firmware for division, dividing 30,000 by 3 (without optimization) involves 10,000 machine cycles (subtract 3 from 30,000 10,000 times).

Don't get me wrong, the PIC is a very powerful microcontroller. But just as a power drill is a powerful tool, it is not great at driving a 10 penny nail.

To borrow from another thread: Choose the path you follow wisely.
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...

Last edited by Mike Betts : 08-01-2004 at 12:16.