This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Float assigns are zero on Cortex M4

Using C in Keil, WITH FPU support turned on, assigns to variables of Float type are coming up as zero. Assigns from constants end up as zero.

For example:
int16_t myInt=0x1234;
float myFloat;

myFloat= (float)myInt; //assigns to zero
myFloat/= (float)MAX_INT;

The debugger Watch window shows that it assigned myFloat to zero in the first line, and the division line throws a hard fault, likely because it turned the right-hand value to zero too, making it a divide-by-zero situation.

What's going on here? I played with this for awhile, never got Float to work.