IFI loader help!

Ok, so i’ve been trying to download code to the EDUbot for about 2 weeks, but it doesn’t work. When I tried to download, a box would pop up saying:


I would also get back a file called ERROR.MCP, filled with a buncha hex numbers. And the program light would stay yellow. I have IFI_Loader v. 1.0.7 and the memory isn’t a problem, the .map file says 41% is used.

I tried copying my code into the default code function by function, and it starts messing up when i get to my absolute value function. For some reason, this works:

short long abs(short long num)
return num;

but this doesn’t:

short long abs(short long num)
if (num < 0) return -num;
else return num;

Help me please!

“short long” - this seems slightly redundant… might try “short int”, “int”, or “long”.

“short long” is a 24 bit variable; check the programming reference guide.
Anyway, that’s not the problem. It worked with short longs before.

just somewhat curious as to why you’re using them.

It has all the symptoms of running out of data or program space.
Sorry to say (or is it good news?) there’s absolutely nothing wrong with the code you posted (as you knew). The only thing you didn’t mention is how much data space you are filling.
A simple test would be to comment out something else that frees up data space, then add in your abs function.
Any overly large arrays hidden elsewhere in the code, array macros used repeatedly (found one guy who did that with his SIN table, boy did his data space disappear fast!), other things that don’t show up in the program space total?

Try varying the combinations of other software you’ve added in with particular attention to high volume variable users.

If you’d like to email be your zipped project I’d be glad to serve as a second pair of eyes. You know how it can be sometimes when you’re looking at your own code.

As a side note I just noticed today’s revision of the FRC default code removes some IFI debug code and frees up more program space.

Few things i would try. First, make absolutely sure you have the most recent version of the IFI Loader, from InnovationFirst

Second, try instead of return -num;, try return 0-num; Only because in the past it has given me weird errors because of the - sign as an opposite.

Other than that, check the piece of code above it, if a {} is not closed correctly, it may cause errors. BTW, do you have the function prototype listed in the top of the code?

I had an inspiration today as I played with my calculator in math class. When I multiplied numbers too big, i got a message that said “Overflow,” which is the same message I got from IFI loader. I have a sin function in my code which uses a MacLaurin series expansion to approximate sin. The code looks like this:

int sin(unsigned int theta)
if (theta > 9000) {return (-sin(theta - 18000));} /maclaurin series for approximation, works only in radians/

         else {
	float th = theta * 3.1415/ 18000;
	return (int)(th - (th * th * th / 6) + (th * th * th * th * th / 120) * 100);

}/* end sin*/

so I think the pic couldn’t raise an unsigned int to the fifth power, because the number got too large. I commented out the math and now it works.


yep. that would make sense. that’s the problem with forums - unless you post the entire thing, it’s possible that we can’t see the problem :slight_smile: