Programming FAQ

It seems like we get a lot of the same questions here. So, here’s a repository of some of the most common ones. Feel free to post your own with answers.

If you have a question that is not answered here, please search first. I can almost guarantee that someone has asked a similar question before.

Q. MPLAB says that it can’t find “xxx.h”. What’s up?
A. if it’s a standard header (eg, #include <adc.h>) then odds are that MPLAB is misconfigured. Either set the include directory manually, or reinstall MCC18 and checking the check boxes.

I need help programming my autonomous?
Look here, there, here, there, here & in the programming white papers & Search for more. There is more stuff than you can imagine.

//Brandon or any mod, Make this a sticky if you can…

This one got me for a while when I first started using the RC.

Q: My robot isnt responding to controllers, wont download a new program, and is stuck in disabled mode. What do I do?

A: 1)hold down both the program and reset buttons.
2)Then, let go of the reset button. (The power light will be blinking green. )
3)Wait until the green light is solid.
4)Let go of the program button.

or see here

Q. I get an error when i try to compile:

Error - Source file ‘C:\path hat’s oo\long\for he\compiler\ifi_utilities.c’ name exceeds file format maximum of 62 characters.

How do I fix this?

A. Don’t put the code on the Desktop or My Documents. Here’s why:

MCC18, the compiler, can only handle paths that are less than 62 characters long. Here is a few paths to the Desktop and My Documents (with the first 62 in green and everything else in red):

  • C:\Documents and Settings\Kristin & Steve\Desktop\FIRST Code\Default code\ifi_utilities.c
  • D:\Documents and Settings\Astronouth7303\My Documents\Robotics stuff\codes\Default code\main.c

A better place to put it would be C:\Code\Default Code.

Similar to Tom’s:

Q: My programming is running the way it should!

A: Amazingly, about a quarter of the time it isn’t really your fault. Try pressing the reset button on the robot controller, then re-download. Sometimes things just get a little corrupted. If it still doesn’t work, then start debugging your code…

**Q. **My programming isn’t running the way it should!

A. See above. But when it is running the way it should, about a quarter of the time it still isn’t your fault :wink:

You know… actually technically that isn’t true. Sorta. It is true that it generates an error, but the problem with the 62-character limit is only with the COD file that the linker tries to generate, none of the other files. Correct me if I’m wrong, but I don’t think that the COD file is actually used for anything, so you could use as big of a path as you would like if this file wasn’t generated.

That being said, I am using MPLAB 7 (which you can download at, so it may not be possible to disable this in MPLAB 6.x. I know a vast majority of you will be using 6.x because it was distributed with the C18 software last year… someone please correct me if this option isn’t available in MPLAB 6.x. If you’re using the C18 tools by the command line, then just add option /w and it shouldn’t generate the file also… which, you can edit the command line in MPLAB 6.x, so you can just add the /w switch to the MPLINK command and not have a problem.

Here’s the workaround for MPLAB 7.

In the MPLAB menu:

Project-> Build Options -> Project

Click on the tab “MPLINK Linker”, and check the option “Supress COD-file generation”.

Now it won’t generate this file, and you can use a path as big as you would like to use. Well, within reason… :smiley:

Apparently, the C-Bot CD that has the licensed version of C18 does not have the correct linker in its c:\mcc18\ directory… so if you use the /w option you will get “invalid option” and still have the problem. However, if you tell MPLAB to use the linker that it came with (located in c:\program files\Microchip\MPASM Suite\mplink.exe), then it should work with no problem

With all that said, if you don’t feel like dealing with any problems, don’t touch anything, use the default stuff, and make sure your path is under 62 characters :slight_smile:

Question: What OS is on the robot? If there is none or its horrible can I put embedded Linux on it? I only run Linux myself, is it possible to program this robot on Linux? Is there some sort of emulator I can get so I don’t have to be with the robot, or it dose not have to be fully built for me to test?
Or basically
I am a rookie, where do I start, I want to learn about the robot controller.

Answer: OK first, yes you can program this robot using Linux. Visit and you should find some more information. For starting off, I highly recommend the documents on…cumentation.htm
And then if you are advanced enough you can look at this page, but only if you are a really core programmer. Otherwise innovation FIRST is the best place to start.

To answer another part of you question, there is no OS on the robot controller. It is a microchip which understands C and assembler. Search, Read documents and get a feel of what our robot controller(microchip product) is. Its might not be such a good idea to try to go as far and put Linux on there or something, Search, Read documents you can find and you will get a feel.


Question: Does everyone use the C18 compiler? Or do some of you use the Visual Studio C compiler?

If you use the Visual Studio C complier, how would you download the code to the RC?

You must use the C18 compiler. The Visual Studio C++ compiler does not target the Microchip microcontroller.


Q: Where can I find all this cool stuff that was talked about in the (2005) kickoff?

A: The Camera stuff, default code, (eventually) the new firmware (master code), and technical docs are on The link to the new IDE and MCC18 compiler are on FIRST’s website (


A: Yes, we know you can’t download the compiler right now. Asking again won’t help. Just try again later (like tomarrow) and hope it works. We can’t do anything about it no matter how much you pester us.

Q. Why won’t my program link? (Generic Linking problems)

A. If you have any kind of linking problems, the first thing you should do is to tell it to Build All (Ctrl+F10, or Project > Build All). If this doesn’t help, keep digging here.

Not quite. The controller doesn’t understand C or ASM actually, the compiler and linker turns these languages into machine code which the controller can understand. It works just like any other processor in that way. :slight_smile:

I believe another thread on this forum is porting RTOS to the microcontroller.

I e-mailed the support e-mail address on and the next day it worked. I don’t know if this was just coincidence or if it was because of my e-mail, but there it is.

This is now outdated. At kick-off, Dave Lavery said that the compiler would be on Microchip’s website for 2 weeks. The beggining of week number three was January 22, 2005. If you are still in need of a compiler, your best bet is to contact another FIRST member.

Right now for my team I am the only ““programmer”” so we are using the same code from last year to run the new one, but the computer that held it crashed and our back up is sitting on a college freshmen’s desk.

Q. is there anyway to “uncompile” the code directly from the controller? or do i have to start from scratch?

You cannot exactly “uncompile” a code. What you can do is recover what is already in the robot. Check out IFIs website for the software and details.

“Device Reader (zip, 2-1-2005) for reading and restoring Code in a RC (can not modify the code), instructions included.”

Once the code is compiled (which is the state the downloaded code is in), it’s stuck that way. There are few ways to decompile it back to the original C code it was compiled from.

I’m afraid you’re stuck.

thanks i geuss i’ll have just rebuild it

I just have a quick question. How do you load a program into an old robot controller that does not have the "prog"ram button? :confused: