This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F280049: sprintf error with floats

Part Number: TMS320F280049

Tool/software:

hello sirs,

i am trying to work with sprintf function that works fine with int variable, but my software crashes with float variables, do you have an idea of what i am doing wrong??

Wrong code:

  case potenzaAttiva:
    rl = working_data.phases[0].readings.active_power;

    f1 = rl;
    f1 /= 1000.0;
    sprintf(str,"%f", f1); // f1 is float
  break;

correct code

  case potenzaAttiva:
    rg = working_data.phases[0].readings.active_power;
    sprintf(str,"%d", rg);  // rg is int
  break;

i would like to use float variables, but i can't, why? The program crashes and i get an error interrupt which yelds ESTOP0.