AnsweredAssumed Answered

Floating Point for STM32F303RE and IAR compiler

Question asked by David Pekin on Feb 6, 2018
Latest reply on Feb 6, 2018 by David Pekin

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.

Outcomes