Categories
Manufacturers
Home  /  Community  /  ST Automotive Microcontrollers  /  [Solved] How can I print an Integer

[Solved] How can I print an Integer



gl2 2015-07-01

Posted on July 01, 2015 at 12:14 Hello. I use the board SPC560P-DISP. How can I print an Integer with Tera Term through a serial connection? I use the function chnWriteTimeout to print a string. So: chnWriteTimeout(&SD1, (uint8_t *) 'Hello World!\r\n' , 14, TIME_INFINITE); But an Integer? I tried to use chprintf, but not working. It does not recognize the function chprintf. I included the header chprintf.h uint32_t number=25; chprintf(&SD1, '%u \n\r' , number); The error is: main.c:(.text_vle.main+0x10c):undefined reference to `chprintf' collect2:ld returned 1 exit status make:*** [build/ out .elf] Error 1 In the demo of SPC5 Studio for my board they use only chnWriteTimeout. Best regards Gianluca.

------------------------------
Posted on July 07, 2015 at 11:59 Ok, I solved so: chprintf((BaseSequentialStream *)&SD1, 'Value of dur is:%d', dur); There was no cast. Thanks. Best regards Gianluca.





Request for Quotation
Part Number *
Manufacturer
Contact Person *
Email Address *
Inquiry Quantity *
Delivery Country *