Announcements
Community Announcement : Welcome to the NEW Cypress Developer Community.
cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4

Anonymous
Not applicable

Hi,

   

i would like to display the results of a division as a float using sprintf and display it using the UART communication component.

   

My code is give below.

   
    

 

   
   

float ft,db;

   
    char buffer[20];   
   
        
   
    db=9.9*3.141;    
   
    sprintf(buffer,"value=%f\n\r",db);   
   

UART_UartPutString(buffer);        

   

 

   

I don't get any value at all on my terminal program.

   

Just 

   

value=

   

I am unable to understand how to display float values using sprintf.

   

I am using PSOC Creator 3.2

   

thanks

   

a

0 Likes
3 Replies
Bob_Marlowe
Expert II

3 steps to success:

   

Update to latest Creator 3.3 CP3

   

under Projects-> Build Settings -> Linker: Set Use newlib-nano float formatting to true

   

in .cydwr view (where you set the pins) "System"-tab: set Heap size to 0x0200

   

 

   

Bob

0 Likes
Anonymous
Not applicable

thanks for the quick reply, its working in 3.3, I am able to get the float values displayed.

   

However there is a problem in the PSOC Creator 3.3 CP3 software.

   

I have noticed that changes to the font size and style do not get saved, they keep getting back to the default setting.

   

Also the recent projects list is not updated, no recent projects are displayed. Also the software startup is very slow.

   

All the above problems surfaced suddenly after the program froze, and I had to restart the computer.

   

However thanks for your help, I realize I may have to raise a support ticket or something.

   

thanks

   

a

0 Likes
rola_264706
Honored Contributor II

You are low on resources on your computer Or it is a very slow processor clock.  Try to reinstall the software again.

0 Likes