View unanswered posts | View active topics It is currently Sun Dec 21, 2014 3:53 pm






Reply to topic  [ 14 posts ] 
RobotC Exception Violation 
Author Message
Rookie

Joined: Sat Jun 09, 2007 8:41 am
Posts: 7
Post RobotC Exception Violation
I was going thru the RobotC software training, videos 7 and 8, on NXT movement. I tried writing a small program.

I'm getting an error message:

RobotC Exception Violation Report
Byte Code Interpreteter Exception:
Program Slot 0, Task ID: main[0]
Error at PC: BAD-LOC + 0x11554
Task PC: Task offset 006F
Task State: 'Exception'
Exception Type: 'Unknown(69)'


Sat Jun 09, 2007 9:02 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Jan 31, 2007 3:39 am
Posts: 299
Location: San Diego, California. USA
Post 
Can you post the code that brings up the error. Thanks!

Scott

_________________
Mmmm Legos B-)

My Robot Projects:
http://www.freewebs.com/robotprojects/


Sat Jun 09, 2007 9:43 am
Profile WWW
Rookie

Joined: Sat Jun 09, 2007 8:41 am
Posts: 7
Post 
Code:

// Program:  Test nMotorEncoder
// steve  June 2007
// Lego Mindstorm NXT and RobotC from Carnegie Mellon University
//
// Test Results
// Test 1:

task main()
{
//  nSyncedMotors = synchCB;
//  nSyncedTurnRatio = 100;

//  bFloatDuringInactiveMotorPWM = false;
//  nMotorPIDSpeedCtrl[motorC] = mtrEncoderReg;
//  nPidUpdateInterval = 5;

//  Test 1: Control each motor's distance and speed.
//  Results:  Use 94 degrees to go 100 degrees.

  int s1 = 0; int s2 = 0;

  nMotorEncoder[motorC] = 0;
  nMotorEncoder[motorB] = 0;

  s1 = 1; s2 = 1;
  while ( s1 == 1 || s2 == 1)
    {
       if (nMotorEncoder[motorC] < 94)
          {motor[motorC] = 20; s1 = 1;}
       else {motor[motorC] = 0; s1 = 0;}
       if (nMotorEncoder[motorB] < 94)
          {motor[motorB] = 20; s2 = 1;}
       else {motor[motorB] = 0; s2 = 0;}
        }
  wait1Msec(10000);



//  Test 2: Try motor syncronization.

  nSyncedMotors = synchCB;
  nSyncedTurnRatio = 100;
  nMotorEncoder[motorC] = 0;
  nMotorEncoder[motorB] = 0;

  s1 = 1;
  while ( s1 == 1)
  {
    if (nMotorEncoder[motorC] < 94)
       {motor[motorC] = 20; s1 = 1;}
    else {motor[motorC] = 0; s1 = 0;}
   }

   wait1Msec(10000);

}  // End Task Main


Sat Jun 09, 2007 10:26 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Jan 31, 2007 3:39 am
Posts: 299
Location: San Diego, California. USA
Post 
Hmmm, i copied your code and had no problems running it, it acted strangely but it did run.

I might see your problem however. One thing I recommend is not use s1 or s2 as variables. The reason is S1, S2, S3, and S4 are already defined for sensor ports. Also, a variables text color should be black if on default settings, but yours are red which makes me think its trying to use them as sensor ports, not variables. Try changing your variables and seeing if that helps and message back.

Scott B-)

_________________
Mmmm Legos B-)

My Robot Projects:
http://www.freewebs.com/robotprojects/


Sat Jun 09, 2007 6:04 pm
Profile WWW
Rookie

Joined: Sat Jun 09, 2007 8:41 am
Posts: 7
Post 
This code generates a RobotC Exception Violation Report - Byte Code Interpreter Exception .... BAD-LOC .... Unknown(69) :
_______________


Code:

task main()
{
  nSyncedMotors = synchCB;
  nMotorEncoder[motorB] = 0;
}


Sat Jun 09, 2007 8:48 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Jan 31, 2007 3:39 am
Posts: 299
Location: San Diego, California. USA
Post 
This code ran fine for me as well....

When you installed Robot C, did you remove all previous versions using add/remove programs? Also, are you using Robot C 1.05?

Scott

_________________
Mmmm Legos B-)

My Robot Projects:
http://www.freewebs.com/robotprojects/


Sat Jun 09, 2007 8:56 pm
Profile WWW
Novice

Joined: Sun Feb 04, 2007 12:48 am
Posts: 69
Location: Australia
Post 
Hi Steve,

I'm not sure if you are experiencing a similar problem to me but I had a problem at one stage with syching motors. By the look of it you have made C the Master motor and B the Slave. I don't think you can then send commands to the slave motor, you can only address the master motor (in this case motorC) until you unsych the two motors. Try:

Code:
task main()
{
  nSyncedMotors = synchCB;
  nMotorEncoder[motorC] = 0;
}



Cheers,
James


Sat Jun 09, 2007 9:56 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Jan 31, 2007 3:39 am
Posts: 299
Location: San Diego, California. USA
Post 
Ahah i got it to crash, James is right, you cant send commands to a slave motor. Thanks James B-)

Scott

_________________
Mmmm Legos B-)

My Robot Projects:
http://www.freewebs.com/robotprojects/


Sat Jun 09, 2007 11:18 pm
Profile WWW
Creator
Creator

Joined: Fri Feb 09, 2007 9:21 am
Posts: 615
Post 
Here's a complete listing of the various exceptions. I have updated ROBOTC firmware so that your error -- 69 -- provides a more meaningful text string rather than "Unknown".

Code:
///////////////////////////////////////////////////////////////////////////////////////////////
//
//                              Exception Types
//
//////////////////////////////////////////////////////////////////////////////////////////////

typedef enum
{
  exceptionNone                       = 0,
  exceptionSensorOutOfRange           = 1,
  exceptionMotorOutOfRange            = 2,
  exceptionTimerOutOfRange            = 3,
  exceptionEventOutOfRange            = 4,
  exceptionVariableOutOfRange         = 5,
  exceptionOutOfRange                 = 6,
  exceptionArrayOutOfRange            = 7,

  exceptionViewVariableOutofRange     = 8,

  exceptionStackOverflow              = 9,
  exceptionStackUnderflow             = 10,

  exceptionInvalidOpcode              = 11,

  exceptionReadOnlyParm               = 12,

  exceptionPCOutOfRange               = 13,

  exceptionUnused                     = 14,

  exceptionInvalidSubroutine          = 15,
  exceptionInvalidSubroutineReturn    = 16,

  exceptionAssertFailure              = 17,
  exceptionParmOutOfRangeRead         = 18,
  exceptionSystemParmOutOfRange       = 19,
  exceptionValueOutOfRange            = 20,
  exceptionUartParmOutOfRange         = 21,
  exceptionSoundParmOutOfRange        = 22,
  exceptionTaskOutOfRange             = 23,
  exceptionInvalidLengthLongMessage   = 24,

  exceptionInvalidBreakpoint          = 25,
  exceptionWordReadOfLongParm         = 26,
  exceptionFloatNotSupported          = 27,
  exceptionLongNotSupported           = 28,
  exceptionBreakpoint                 = 29,
  exceptionToManyBreakpoint           = 30,
  //unused,
  //unused,
  //unused,
  //unused,
  //unused,
  //unused,
  exceptionIllegalFloatOperand        = 37,
  //unused 38
  exceptionInternalError              = 39,
  exceptionParmOutOfRangeWrite        = 40,  // Bad Opcode Source
  exceptionInvalidPConBranch          = 41,
  exceptionInvalidPConSubReturn       = 42,
  exceptionInvalidInternalQueues1     = 44,
  exceptionInvalidInternalQueues2     = 45,
  exceptionInvalidInternalQueues3     = 46,
  exceptionInvalidInternalQueues4     = 47,
  exceptionInvalidInternalQueues5     = 48,
  exceptionInvalidInternalQueues6     = 49,
  exceptionInvalidInternalQueues7     = 50,
  exceptionInvalidInternalQueues8     = 51,
  exceptionInvalidInternalQueues9     = 52,
  exceptionInvalidInternalQueues10    = 53,
  exceptionInvalidInternalQueues11    = 54,
  exceptionInvalidInternalQueues12    = 55,
  exceptionInvalidInternalQueues13    = 56,
  exceptionInvalidInternalQueues14    = 57,
  exceptionInvalidInternalQueues15    = 58,
  exceptionInvalidEventListMap1       = 58,
  exceptionInvalidEventListMap2       = 59,
  exceptionInvalidEventListMap3       = 60,
  exceptionInvalidEventListMap4       = 61,
  exceptionInvalidEventListMap5       = 62,
  exceptionInternalAsmGlueError       = 63,
  exceptionDatalogIndexError          = 64,
  exceptionDatalogRawNotImplemented   = 65,
  exceptionDatalogOverflow            = 66,
  exceptionInvalidDatalogSourceType   = 67,
  exceptionRealAddressOutOfRange      = 68,
  exceptionCannotUpdateSlaveSync      = 69,

  exceptionUnknown                    = opEnumType 255
} TVMException;


You can also find the above enum in the file "OpcodeDefinitions.h" that is included in the RobotC distribution.

You can use the information in the exception report to help isolate the problem area in your code. Looking at the typical exception below.

Code:
RobotC Exception Violation Report
Byte Code Interpreteter Exception:
Program Slot 0, Task ID: main[0]
Error at PC: BAD-LOC + 0x11554
Task PC: Task offset 006F
Task State: 'Exception'
Exception Type: 'Unknown(69)'


The report indicates that there was an exception 69 at offset (hex) 006F in task "main". You can use the list of exceptions to determine what 69 means. Use the 'F9' key in ROBOTC to get a listing of your program with assembler opcodes included. Find the code for task "main". Look for the instruction at opcode that is at offset '6F'. This is the instruction after the exception so look for the previous instruction. Now look for the C code that precedes this instruction -- this is the code line that generated the exception.


Fri Jun 22, 2007 6:09 am
Profile
Rookie

Joined: Tue Mar 08, 2011 7:33 pm
Posts: 1
Post Re: RobotC Exception Violation
hey guys

I have also been experiencing a similar problem...

Byte Code Interpreter Exception:

Program Slot: 0, Task ID: main[0]
Error at PC: Task: main+0x0042
Task PC: Task offset start(0)
TaskState: 'Exception'
Exception Type: 'Motor out of range(2)'


the code i have been using is a similar one from the tutorials



task main()
{
motor(motorB) = 100;
motor(motorC) = 100;
wait1Msec (3000);
}

thanks Danz


Tue Mar 08, 2011 7:38 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3297
Location: Rotterdam, The Netherlands
Post Re: RobotC Exception Violation
You should be using motor[motorC] and motor[motorB], they're not functions, they're arrays.

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Wed Mar 09, 2011 1:48 am
Profile WWW
Rookie

Joined: Thu Jul 28, 2011 3:37 am
Posts: 2
Post Re: RobotC Exception Violation
Thanks for the complete list of various exceptions


Thu Jul 28, 2011 3:46 am
Profile
Rookie

Joined: Wed Oct 09, 2013 3:55 pm
Posts: 19
Post Re: RobotC Exception Violation
I got a simmaler problem using this line of code
Code:
   motor[Right] = vexRT[Ch3] - vexRT[Ch1];

the whole program is this:
Code:
#pragma config(I2C_Usage, I2C1, i2cSensors)
#pragma config(Sensor, I2C_1,  ,               sensorQuadEncoderOnI2CPort,    , AutoAssign)
#pragma config(Motor,  port1,           Right,         tmotorVex393, openLoop)
#pragma config(Motor,  port2,           Shooter,       tmotorVex393, openLoop, encoder, encoderPort, I2C_1, 1000)
#pragma config(Motor,  port3,           Arm,           tmotorVex393, openLoop)
#pragma config(Motor,  port10,          Left,          tmotorVex393, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main()
{
   while(1)
      {
      nMotorEncoder[I2C_1] = 0;
      motor[Right] = vexRT[Ch3] - vexRT[Ch1];
      motor[Left] = vexRT[Ch3] + vexRT[Ch1];
      if(vexRT[Btn6D] == 1)
      {
         while(nMotorEncoder[I2C_1] < 5)
            {
            motor[Shooter] = 127;
      if(vexRT[Btn8R] == 1)
         motor[Arm] = 65;
      if(vexRT[Btn8D] == 1)
         motor[Arm] = -65;
         }
      }   
   }
}

HELP ME!!!


Thu Nov 21, 2013 3:24 pm
Profile
Rookie

Joined: Wed Oct 09, 2013 3:55 pm
Posts: 19
Post Re: RobotC Exception Violation
Also, I forgot, the program wont shoot or lift the arm. Anyone know whats with that?


Thu Nov 21, 2013 3:26 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 14 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.