|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Number of liines of code in user_routines.c
Yeah under a 1000 isnt bad. Also it has to do with how you code. Theres all sorts of ways to cut number of lines in half without changing anything.
Example PHP Code:
PHP Code:
|
|
#2
|
|||
|
|||
|
Re: Number of liines of code in user_routines.c
I mostly do it this way... and i also include all the brackets... even though sometimes you dont have too..
|
|
#3
|
||||
|
||||
|
Re: Number of liines of code in user_routines.c
Yeah, depending on your style of coding and how many comments you actually add, the lines can vary tremendously. What's more important is the actual amount of data space you use. If you're using MPLAB (and I'm assuming you are), go to View->Memory Usage Gauge, and this will tell you both the amount of code and variable space you're using.
We overflowed the 2005 processor trying to get the camera and a driver perspective drive system with a gyro working. Last year we ended up using about 1/5 of the available space. |
|
#4
|
|||
|
|||
|
Re: Number of liines of code in user_routines.c
So assuming some one uses a very inefficient coding style i.e something like this:
Code:
int values[3];
for(int i =0; i<=2; i ++)
{
switch i
case 0:
values[0] = 0;
case 1:
values[1] = 0;
case 2:
values[2] = 0;
}
Code:
for (int i =0; i<=2, i++)
{
values[i] = 0;
}
|
|
#5
|
||||
|
||||
|
Re: Number of liines of code in user_routines.c
In an ideal world, yes, the compiler should do about the same thing. However, we're talking about MPLAB's compiler here, and it's far from "ideal". Something tells me even GCC would have difficulty optimizing it. My best bet goes to Intel's super-optimizing compiler. It's too bad we can't have something like that for our PICs.
As for code length in user_routines.c? It's only about 400-500. That's because I split my code up into multiple files. In all, I think I've written about 2000 in the pre-season this year. I've also taken the time to write my own camera code as opposed to Kevin's (it's good, just a little drawn out, IMHO). Last edited by Cjmovie : 31-12-2006 at 17:07. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| position of fleid lines | Tachion | FIRST Tech Challenge | 1 | 05-12-2005 14:36 |
| field lines | Tachion | FIRST Tech Challenge | 0 | 15-11-2005 15:46 |
| cruise lines | robot180 | Chit-Chat | 9 | 29-06-2004 22:03 |
| Extruding Lines | Jim Giacchi | Inventor | 7 | 21-08-2002 17:30 |