cancel
Showing results for 
Search instead for 
Did you mean: 

Floating Point for STM32F303RE and IAR compiler

David Pekin
Senior
Posted on February 06, 2018 at 21:17

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.

1 ACCEPTED SOLUTION

Accepted Solutions
David Pekin
Senior
Posted on February 06, 2018 at 22:22

It appears that it's an issue with the IAR debugger not displaying floats correctly.  The code actually executes and passes vars correctly.

View solution in original post

1 REPLY 1
David Pekin
Senior
Posted on February 06, 2018 at 22:22

It appears that it's an issue with the IAR debugger not displaying floats correctly.  The code actually executes and passes vars correctly.