Log in

View Full Version : Another Loader Error


Semicolon
08-02-2006, 18:41
When we loaded our code to the robot, :eek: it popped up with a bunch of errors. After some trial and error, we found it was our timer code and our autonomous code that caused the errors. The errors were wierd too. Once loaded, the loader would tell us there was an error and pop up with a bunch of hexidecimals that make no sense (to us anyway).

:ahh: WHAT'S UP WITH THAT!?!?!? :ahh:

P.S. if it will help to see the code, just ask.

Tureyhall
08-02-2006, 18:42
it ALWAYS helps to see the code AND the errors/hex that came with the errors.

Semicolon
08-02-2006, 18:57
it ALWAYS helps to see the code AND the errors/hex that came with the errors.

Here you go. Can't get errors right now, but could you tell me how to find out what they mean?

/************************************************** *****************************
*
TITLE: 399Auto.c
*
* VERSION: 0.1 (Beta)
*
* DATE: 04-Oct-2005
*
* AUTHOR: Semicolon
*
* COMMENTS: Hello!
*
************************************************** ******************************
*
* CHANGE LOG:
*
* DATE REV DESCRIPTION
* ----------- --- ----------------------------------------------------------
* Nothing
*
************************************************** *****************************/
//--Header Files--\\
#include <stdio.h>
#include <math.h>

#include "ifi_aliases.h"
#include "ifi_default.h"
#include "ifi_utilities.h"
#include "user_routines.h"
//#include "user_Serialdrv.h"
#include "399code.h"
#include "399Auto.h"
#include "tracking.h"
#include "camera.h"

#define AUTOSPEED 50
#define AUTOFWD 127+AUTOSPEED
#define AUTOBK 127-AUTOSPEED
#define MOTORSTEP 1

extern int motor01accel;
extern int motor02accel;
extern int AutoState;
extern int Centering;
int RobotTime = 0;
extern int Alarm;
extern int cent;
extern int dista;
extern int motor03;
extern int motor04;
extern int motor01;
extern int motor02;



/************************************************** *****************************
* FUNCTION NAME: TimerUpdate
* PURPOSE: Updates the robot time
* CALLED FROM: Autonomous399()
* ARGUMENTS: void
* RETURNS: void
* NOTES: Robot Time is in miliseconds
************************************************** *****************************/
void TimerUpdate(void)
{
// RobotTime = RobotTime + 26;

// printf("RobotTime:%d\r\n",RobotTime);
}
/************************************************** *****************************
* FUNCTION NAME: SetAlarm
* PURPOSE: Sets an alarm that will go off in the alloted time
* CALLED FROM: Process_Data_From_Master_uP
* ARGUMENTS:
* Argument Type Description
* -------- ------ -----------
* Seconds int It is Miliseconds
* RETURNS: void
* NOTES: I don't care, I mean who gives a crap anyway? I figure if you're looking at this
You probably want to know what this does, but if you dont already know what
This does, you didn't program it and if you didn't program it
Then you're probably not a programmer who wouldn't understand
this stuff anyway right? Right.
************************************************** *****************************/
void SetAlarm(int Seconds)
{
// Alarm = RobotTime + Seconds;
}
/************************************************** *****************************
* FUNCTION NAME: Manual399
* PURPOSE: What the robot does in Manual Mode
* CALLED FROM: Process_Data_From_Master_uP
* ARGUMENTS: void
* RETURNS:
* Returns Descriptionuser_Routines_Fast
* -------- -----------
* 1 Alarm has fired
* 0 Has not reached the Alarm
* NOTES: I don't care
************************************************** *****************************/
int CheckAlarm(void)
{
// int flag = 0;

// if(RobotTime >= Alarm)
// flag = 1;

// return flag;
}
/************************************************** *****************************
* FUNCTION NAME: Autonomous399
* PURPOSE: What the robot does in Autonomous Mode
* CALLED FROM: User_routines_Fast/User_Autonomous_Code()
* ARGUMENTS: void
* RETURNS: void
* NOTES: Well if you have a pole one light year long and you pull on it
does the other side take a whole year to move or does it move right away?
If it moves right away then there is something out there that
moves faster than the speed of light, but didn't Einstein say that
the speed of light is the universal speed limit?
************************************************** *****************************/
void Autonomous399(void)
{
switch(dip_switch())
{
// case 1: Auto1_Shoot(); break;
// case 2: Auto2_Dump(); break;
// case 3: Auto3_(); break;
case 4: break;//DO NOTHING
}
}
/************************************************** *****************************
* FUNCTION NAME: dip_switch
* PURPOSE: turn dip switches to #s 1-4
* CALLED FROM:
* ARGUMENTS: void
* RETURNS:
* Switches Outcomes
* ----------- -----------
* 0 0 1
* 1 0 2
* 0 1 3
* 1 1 4
* NOTES: I don't care
************************************************** *****************************/
int dip_switch(void)
{
int dip;
dip = (4*digital_io_01) + (2*digital_io_02) + digital_io_03;
return dip;
}

/************************************************** *****************************
* FUNCTION NAME: Auto1_Shoot
* PURPOSE: What the robot does in Autonomous Mode
* CALLED FROM: User_routines_Fast/User_Autonomous_Code()
* ARGUMENTS: void
* RETURNS: void
* NOTES: Yeah, so a C++ programmer from Apple walks into a bar and says
"Bartender can I have a soda and soda on the rocks?" and the
Bartender says, "Soda and soda, that doesnt make any sense mister."
and the programmer says, "whoops, looks like I took a ring zero exception
fault on an illegal instruction in the old CPU huh?"
************************************************** *****************************/
/*void Auto1_Shoot(void)
{
// TimerUpdate();
switch(AutoState)
{
case 1:
// SetAlarm(1500);
AutoState = 2;
break;
case 2:
pwm04 = pwm05 = pwm06 = pwm07 = 200;
pwm08 = pwm09 = motor03 + MOTORSTEP;
if(CheckAlarm()1)
{
pwm04 = pwm05 = pwm06 = pwm07 = 127;
AutoState= 3;
}
break;
case 3:
if(Center_On_Goal() == 1)
{
AutoState = 4;
}
break;
case 4:
if(MoveInOnGoal() == 1)
{
AutoState = 5;
}
break;
case 5:
pwm08 = pwm09 = pwm10 = pwm11 = 254;

break;
}
}
/************************************************** *****************************
* FUNCTION NAME: Auto2
* PURPOSE: What the robot does in Autonomous Mode
* CALLED FROM: User_routines_Fast/User_Autonomous_Code()
* ARGUMENTS: void
* RETURNS: void
* NOTES: Are you still seriously reading these things? If you want the notes
you'll have to go to class yourself, I am tired of pulling your
weight around here, seriously, next time you're absent I'm not taking
the notes for you.
************************************************** *****************************/
/*void Auto2_Dump(void)
{
motor03 = pwm09 = pwm08;
// TimerUpdate();
switch(AutoState)
{
case 1:
// SetAlarm(800);
AutoState = 2;
break;
case 2: //Turn Right .8s
pwm04 = pwm05 = 254;
pwm06 = pwm07 = 0;
pwm08 = pwm09 = motor03 - MOTORSTEP;
if(CheckAlarm())
{
pwm04 = pwm05 = pwm06 = pwm07 = 127;
// SetAlarm(1500);
AutoState = 3;
}
break;
case 3: //go forward 1.5s
pwm04 = pwm05 = pwm06 = pwm07 = 254;
if(CheckAlarm()1)
{
pwm04 = pwm05 = pwm06 = pwm07 = 127;
AutoState = 4;
}
break;
case 4: //DUMP
pwm08 = pwm09 = 0;
relay1_fwd = 1; //Open Door
break;
}
}
/************************************************** *****************************
* FUNCTION NAME: Auto3_
* PURPOSE: What the robot does in Autonomous Mode
* CALLED FROM: User_routines_Fast/User_Autonomous_Code()
* ARGUMENTS: void
* RETURNS: void
* NOTES: David's.
************************************************** *****************************/
/*void Auto3_(void)
{

motor03 = pwm09 = pwm08;
// TimerUpdate();
switch(AutoState)
{
case 1:
// SetAlarm(10000);
AutoState = 2;
break;

case 2:
pwm04 = pwm05 = pwm06 = pwm07 = 254;//floor it!//
if(CheckAlarm())
{
AutoState = 0;
pwm04 = pwm05 = pwm06 = pwm07 = 127;
}
break;
}
}
*/

Give credit where it's due! (me by the way)

Tureyhall
08-02-2006, 19:12
this is what happens when you take out all the commented out code. this is all that the compiler/robot sees:


/************************************************** *****************************
*
TITLE: 399Auto.c
*
* VERSION: 0.1 (Beta)
*
* DATE: 04-Oct-2005
*
* AUTHOR: Semicolon
*
* COMMENTS: Hello!
*
************************************************** ******************************
*
* CHANGE LOG:
*
* DATE REV DESCRIPTION
* ----------- --- ----------------------------------------------------------
* Nothing
*
************************************************** *****************************/
//--Header Files--\\
#include <stdio.h>
#include <math.h>

#include "ifi_aliases.h"
#include "ifi_default.h"
#include "ifi_utilities.h"
#include "user_routines.h"
//#include "user_Serialdrv.h"
#include "399code.h"
#include "399Auto.h"
#include "tracking.h"
#include "camera.h"

#define AUTOSPEED 50
#define AUTOFWD 127+AUTOSPEED
#define AUTOBK 127-AUTOSPEED
#define MOTORSTEP 1

extern int motor01accel;
extern int motor02accel;
extern int AutoState;
extern int Centering;
int RobotTime = 0;
extern int Alarm;
extern int cent;
extern int dista;
extern int motor03;
extern int motor04;
extern int motor01;
extern int motor02;





/************************************************** *****************************
* FUNCTION NAME: dip_switch
* PURPOSE: turn dip switches to #s 1-4
* CALLED FROM:
* ARGUMENTS: void
* RETURNS:
* Switches Outcomes
* ----------- -----------
* 0 0 1
* 1 0 2
* 0 1 3
* 1 1 4
* NOTES: I don't care
************************************************** *****************************/
int dip_switch(void)
{
int dip;
dip = (4*digital_io_01) + (2*digital_io_02) + digital_io_03;
return dip;
}


i wonder why nothing works? you've got..... what, 20 lines of code that actually are read? if i missed a close comment or something, just tell me, but i think i didn't take out any used code.

Semicolon
08-02-2006, 19:43
i wonder why nothing works? you've got..... what, 20 lines of code that actually are read? if i missed a close comment or something, just tell me, but i think i didn't take out any used code.

I'm Sorry, i didn't take all the quotes out before i posted it :D . The commented out portions are the ones that don't work. The uncommented one is the only one without an error. Sorry for the miss-post.

Tureyhall
08-02-2006, 19:50
WHAT? are you sure that EVERYTHING that is commented out is bad? i mean, is the SetAlarm function messed up?

you should comment things out ONE FUNCTION AT A TIME, till you make sure that ONLY the ones that don't work are commented out.

Semicolon
08-02-2006, 20:09
WHAT? are you sure that EVERYTHING that is commented out is bad? i mean, is the SetAlarm function messed up?

you should comment things out ONE FUNCTION AT A TIME, till you make sure that ONLY the ones that don't work are commented out.

I did. We ended out commenting all but the dipswitches code. Everytime we commented out another function, the # of errors went down. When I test again, I will post my results and the errors. It might be because at first, we put everything in one c file and then split it into it's own autonomous file. We made extern variables and everything compiled fine, but it went to error when we loaded it. Any ideas? Should I contact someone?

P.S. Can we use float variables in the code? I heard it would be an error.

Joe Ross
08-02-2006, 20:28
What version of the IFI loader are you using? It should be 1.1.0 (not 1.0.10 or 1.0.12).

Greg Ross
08-02-2006, 20:32
When we loaded our code to the robot, :eek: it popped up with a bunch of errors. After some trial and error, we found it was our timer code and our autonomous code that caused the errors. The errors were wierd too. Once loaded, the loader would tell us there was an error and pop up with a bunch of hexidecimals that make no sense (to us anyway).

:ahh: WHAT'S UP WITH THAT!?!?!? :ahh:

P.S. if it will help to see the code, just ask.
I'm guessing you have exceeded the program size that the old ifi_loader can handle. You need v1.1.0 (http://ifirobotics.com/docs/ifi-loader-v1-1-0.zip). (This has been covered in many other threads here on CD. Maybe we need a sticky?)

P.S. If a moderator sees this, and decides to make a sticky thread, my suggestion is New IFI_LOADER! (http://www.chiefdelphi.com/forums/showthread.php?t=42790)

Semicolon
09-02-2006, 17:39
um... hello again.

Solved the Problem!
- We had the new ifiloader and it wasn't that
- It wasn't in the .c code I posted. (everything was dandy there)
- It was in the .h code. (which i unfortunatly didn't post)
- At the begining where it says #if and #define and the name of the header file.
- It said _399Code_h_ instead of _399Auto_h_
- Shows how an error so small becomes something so big. :o
- I'm sorry if I worried any of you too much...