Hi, I’ve searched for previous threads about this problem but none of them seemed to have solved it.
I’m trying to learn how to program a robot so I’m just following the included Getting Started Guide for the MPLab. Compiling my C file gives me no problem. However, when I try to load my hex file onto the IFI loader it gives me the following message:
MPLAB is a generic product, so the examples assume you are using a PIC straight out of the box. That’s not the case for the First or Vex controllers.
If you want to use the Getting Started examples as they are, then you’ll need a PIC development board. I’d suggest getting a Pickit2 development set. Choose one that comes with the programmer to download your code combined with a development board to do the MPLAB exercises on.
Program memory on the FRC/Vex Robot Controller is reserved for other purposes before 0x800. There are also other restrictions due to the FIRST specific architecture of this particular controller that will make it difficult to use.
If you want to use it to learn to code on an FRC Robot Controller then it’s probably easiest to start with Kevin Watson’s basic default code and study how that works. Specifically, ifi_frc_simple.zip.
There are also the tutorials on FIRST’s page that use the IFIdefault code as a basic start.
Hi, my code is just directly copied from the getting started doc that came with the MPLAB IDE (I’m a newbie I’m still trying to learn how to program with a microchip controller), that’s why I don’t understand why THIS CODE, that came with the tutorial can’t load :(.
Here’s the source code:
#include <p18cxxx.h>
#pragma config OSC = HS
#pragma config WDT = OFF
#pragma config LVP = OFF
int counter;
void main (void)
{
counter = 1;
TRISB = 0;
while (counter <= 15)
{
PORTB = counter;
counter++;
}
}
All the other code files that you guys posted seem to work for me, I can load them onto the IFI loader no problem. But my source code gets compiled into a HEX file that just fails. This I don’t understand.
If you want to program starting from scratch on the RC, there are two things you’re going to have to deal with:
There are 2 PIC18F8722’s in the RC, the master and the user. You have no control over the master processor and full control of the user. The master and the user are linked and communicate with each other. I think you can safely ignore the data sent from master to user, but if you don’t send data from user to master about every 25 ms (40 Hz), then the master will kill the RC.
When IFI loader downloads code onto the user, it adds a bootloader to 0x000 through 0x7FF. This means you have to add 0x800 to the reset vector and interrupt vectors, and you also have to make sure none of your code gets placed in 0x000 to 0x7FF (with the linker script).
It’s much easier to just start with the default code and take out things you don’t need.