2018-02-06 12:17 PM
Hello,
I have a project where I'm using some floating point variables. When I pass the float variable into a function (passed by value) the variable inside the function shows 0.0 in the debugger. The code compiles and links without warnings. Maybe I'm missing some compiler define? Below is an example:
//Prototype of callee
static int torqueControl(float Pgain, float Igain, float Dgain, int target);
void caller ()
{
float P = 1.0;
float I = 2.0;
float D = 3.0;
int target = 100;
int retval;
retval =
torqueControl(P,I,D, target); // called w/ PID vals
}
static int torqueControl(float Pgain, float Igain, float Dgain
, int target
){
// inside this function Pgain, Igain and Dgain are 0.0
// but target is correctly 100.
}
Anyone know what might be happening here?
Thanks.
Solved! Go to Solution.
2018-02-06 01:22 PM
It appears that it's an issue with the IAR debugger not displaying floats correctly. The code actually executes and passes vars correctly.
2018-02-06 01:22 PM
It appears that it's an issue with the IAR debugger not displaying floats correctly. The code actually executes and passes vars correctly.