ROBOTC.net forums
http://www.robotc.net/forums/

RobotC Exception Violation
http://www.robotc.net/forums/viewtopic.php?f=1&t=198
Page 1 of 1

Author:  steve [ Sat Jun 09, 2007 9:02 am ]
Post subject:  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)'

Author:  starwarslegokid [ Sat Jun 09, 2007 9:43 am ]
Post subject: 

Can you post the code that brings up the error. Thanks!

Scott

Author:  steve [ Sat Jun 09, 2007 10:26 am ]
Post subject: 

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

Author:  starwarslegokid [ Sat Jun 09, 2007 6:04 pm ]
Post subject: 

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-)

Author:  steve [ Sat Jun 09, 2007 8:48 pm ]
Post subject: 

This code generates a RobotC Exception Violation Report - Byte Code Interpreter Exception .... BAD-LOC .... Unknown(69) :
_______________


Code:

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

Author:  starwarslegokid [ Sat Jun 09, 2007 8:56 pm ]
Post subject: 

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

Author:  JamesD [ Sat Jun 09, 2007 9:56 pm ]
Post subject: 

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

Author:  starwarslegokid [ Sat Jun 09, 2007 11:18 pm ]
Post subject: 

Ahah i got it to crash, James is right, you cant send commands to a slave motor. Thanks James B-)

Scott

Author:  Dick Swan [ Fri Jun 22, 2007 6:09 am ]
Post subject: 

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.

Author:  Danzeau [ Tue Mar 08, 2011 7:38 pm ]
Post subject:  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

Author:  mightor [ Wed Mar 09, 2011 1:48 am ]
Post subject:  Re: RobotC Exception Violation

You should be using motor[motorC] and motor[motorB], they're not functions, they're arrays.

- Xander

Author:  jcarla [ Thu Jul 28, 2011 3:46 am ]
Post subject:  Re: RobotC Exception Violation

Thanks for the complete list of various exceptions

Author:  123girr [ Thu Nov 21, 2013 3:24 pm ]
Post subject:  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!!!

Author:  123girr [ Thu Nov 21, 2013 3:26 pm ]
Post subject:  Re: RobotC Exception Violation

Also, I forgot, the program wont shoot or lift the arm. Anyone know whats with that?

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/