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

In-Program Error
http://www.robotc.net/forums/viewtopic.php?f=1&t=5557
Page 1 of 1

Author:  Coder A [ Thu Feb 28, 2013 10:30 pm ]
Post subject:  In-Program Error

Hello,

As I was running some new code I made on the emulator, I received an error message ( type 59 ). This is the line of error:

p1.yposcu = round((float)((g*(time^2))+(p1.velosz*sinDegrees(p1.thetsz)*time)+p1.ypossz));

p1.yposcu is a short,
p1.thetsz is a short equal to 30,
p1.ypossz is a short equal to 10,
p1.velosz is a short equal to 5,
and time is a float.

g is a constant equal to -9.8.

It does not matter what time is. The error I get is 'real address range exception(59)'.

What went wrong?

Thanks in advance for helping.

-Coder A

Author:  mightor [ Fri Mar 01, 2013 12:36 am ]
Post subject:  Re: In-Program Error

How about you provide us with a piece of actual code that can reproduce this issue. Sometimes the error is actually on the line BEFORE the highlighted one.

= Xander

Author:  Coder A [ Fri Mar 01, 2013 9:41 am ]
Post subject:  Re: In-Program Error

Here:

Code:
while(p1.xposcu>-1&&p1.xposcu<100&&p1.yposcu>-1)
   {
      time = time1[T1]/1000;
      p1.xposcu = round((float)((p1.velosz*cosDegrees(p1.thetsz)*time)+p1.xpossz));
      p1.yposcu = round((float)((g*(time^2))+(p1.velosz*sinDegrees(p1.thetsz)*time)+p1.ypossz));
      nxtSetPixel(p1.xposcu,p1.yposcu);
   }

Author:  magicode [ Fri Mar 01, 2013 10:38 am ]
Post subject:  Re: In-Program Error

Just as a heads up, x^y isn't x to the power y in C. It's a bitwise XOR operator.

Author:  Coder A [ Fri Mar 01, 2013 3:11 pm ]
Post subject:  Re: In-Program Error

Oh, thanks. That is probably the problem. Thanks!

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