Quote:
|
Originally Posted by Mark McLeod
current.theta += (unsigned long) ((gyroin + gyroprev - 1023) * deltat * 8 / 100) + 2000;
|
OK, so if Current.theta is an unsigned int, and I'm setting it equal to an unsigned long, what bits will I lose in the process? the most significant 8?
for example, what if I had this:
Code:
unsigned long longvar = 0xFAAABBBB;
unsigned int shortvar = 0;
shortvar = longvar;
shortvar would be 0xBBBB, right?
and a second question about that, am I getting an overflow error because the pic does math on an int level, and when an operation goes higher than an int I get an overflow error?
Thanks for all your help so far.