I need to write float numbers in the LCD, so I need to convert the numbers to a string to write it on LCD. I wonder if anyone knows if there is a function like *ftoa* or *gcvt* that work in IAR, to do that conversion. Thanks in advance.

I’ve never used MSP devices, but I always use ** sprintf** for conversions to ascii.

I used ** sprintf** and for example, if I use a float number=1.25, the number in the string appears 1.250000 (always with 6 digits after the decimal point). How can I solve this? Thanks.

Try this:

```
sprintf(buffer, "%.2f", number);
```

the number after the ‘.’ character specifies the number of decimal digits you want. If you want more (or less) than 2, just change it. Optionally if want to left align the resulting string you can use this:

```
sprintf(buffer, "%-6.2f", number);
```

You can also use ‘0’ instead of ‘-’ to left align filling with zeros instead of blanks. And there are a lot more options! Printf functions are very powerful, I suggest you to have a look to the function help.