Anonymous
Not applicable
Sep 09, 2011
12:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 09, 2011
12:10 AM
Hie,
Does anyone know how I can convert a float into a string on the psoc5 (gcc compiler)? I would like to convert floats into strings so that I can display on my GLCD which has library functions for displaying only string types.
Labels
- Labels:
-
PSoC 5LP
2 Replies
Anonymous
Not applicable
Sep 09, 2011
07:49 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 09, 2011
07:49 PM
I just discovered that the sprintf() function works perfectly for this conversion. The syntax is something like this:
float a = 4.8375;
char a_text[9];
sprintf(a_text,"%f",a);
a_text[4] = '\0';
this will return the string 4.84
Anonymous
Not applicable
Sep 10, 2011
05:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 10, 2011
05:50 AM
Hi Liberty,
Thank you for sharing this on the forum !