printf() not works for float value in "TWR-K20D72M" board

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

printf() not works for float value in "TWR-K20D72M" board

1,044 Views
bhavinmaru
Contributor III

Hello,

        I am using "TWR-K20D72M" board and "IAR Embedded Workbench IDE" software for coding.this board support virtual serial terminal using "OSBDM/OSJTAG - CDC SERIAL PORT" for display. this terminal supports printf() means using printf() i can print any value in this virtual terminal. if i print any integer,hexadecimal,octal then this printf works properly. please try to solve my below query.

1) using printf if i want to print float value then this will not print float value so i can't print float value in virtual terminal

    using %f.

2) also if i try to convert this float value in string using sprintf() also this function not work properly in this board.   

   

please give me library or API supported by this board so that i can print float value in virtual terminal for this board.

Thank You

Bhavin

Labels (1)
0 Kudos
3 Replies

683 Views
egoodii
Senior Contributor III

In your 'Project...' 'Options...' dialog, 'General Options' group, 'Library Options' tab, specify a printf and/or scanf that includes the formats you are looking for (Large to get float for instance, I use 'Large without multibytes' for printf.

0 Kudos

683 Views
bhavinmaru
Contributor III

Hi EARL GOODRICH Thank you for your reply as per your suggestion in 'Library option' i tried 'Large' and 'Large without multibyte' but still it not print the float value.

0 Kudos

683 Views
egoodii
Senior Contributor III

I guess I should have asked if you have a specific 'printf' routine already in your project (rather than, and thus ignoring, said IAR library version).  If so, I see that you have two options:

Follow the options in this link:

Use and print out floating point with K60 and codewarrior

to update your local printf() and fix/deal-with negatives.

OR remove/disable your local printf() and alter the 'byte input' for that "OSBDM/OSJTAG - CDC SERIAL PORT" process to allow or match the default character-out required-link for the IAR-library printf() function, which I believe is '__write'.  See also:

IAR Overriding and redirecting library modules

0 Kudos