I'm having trouble with my firmware when I pass a value to a function that receives a float (The controller won't initialize correctly). The function is as follow:
u16 u16SUPPLY_REF; //Global
void Switcher_Mode(float Voltage) {
float fSUPPLY_REF; s16 s16SUPPLY_REF;
fSUPPLY_REF = Voltage * 38.7; s16SUPPLY_REF = (s16)fSUPPLY_REF; u16SUPPLY_REF = (u16)s16SUPPLY_REF; }
And I will pass a value to the function like this:
Switcher_Mode(9);
But when I pass the value like this:
Switcher_Mode(9.0f);
The controller will initialize correctly. I'm not sure if the above will make a difference to my porblem because I've tried a few other things that worked for a while.
I know the 'f' is not added to the end of the value, the compiler won't know as what type it should interpret the value.
I'm not sure what causes the controller not to initialize but I'm SURE it has something to do with the passing of the value to the function. Also when I change the receiving type of the function to byte, then the controller will initialize. But I must use a float.
Some ideas and help please.