cancel
Showing results for 
Search instead for 
Did you mean: 

Printing float, integer value

ssk
Associate II
Posted on April 29, 2015 at 08:19

How I can print float or integer values to serial port?

Is debug window access is there like 'debug.print'? If yes, how to access that? Any example for it?

Thanks.

Mike.
This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
1 REPLY 1
Erwan YVIN
ST Employee
Posted on April 29, 2015 at 17:38 Hello Mike , For os-less , you have to use : chnWriteTimeout(&SD1, (uint8_t *)''Hello World! '', 14, TIME_INFINITE); You have to write your own function to display an integer ;) if you do not want to reinvent the wheel , with chibios , you can use chprintf (cf in commands of chibios)

chprintf(chp,

''%.8lx %.8lx %4lu %4lu %9s %lu

''

,
(uint32_t)tp, (uint32_t)tp->p_ctx.sp,
(uint32_t)tp->p_prio, (uint32_t)(tp->p_refs - 1),
states[tp->p_state], (uint32_t)tp->p_time);

for float : (non official)

you have : to add ''-msoft-float'' in your compiler option to emulate float by software. for Chibios , in chibios.h , #define CHPRINTF_USE_FLOAT TRUE

chprintf(chp ,

''%f''

...)

in the next releases , we will update Platform Component . Best regards Erwan