Stm32 Keil implements serial port printf output Chinese characters

Source: Internet
Author: User
Tags printf
Add the following code that can be implemented in a GNUC way #ifdef __gnuc__/* with gcc/raisonance, small printf (option LD linker->libraries->small printf Set to ' Yes ') calls __io_putchar () */#define PUTCHAR_PROTOTYPE int __io_putchar (int ch) #else #define Putchar_p Rototype int FPUTC (int ch, FILE *f) #endif/* __gnuc__ */int main () {while (1) {}}/** * @brief Reta
  Rgets the C library printf function to the USART.  * @param None * @retval None * * Putchar_prototype {/* Place your implementation of FPUTC here */* e.g. write a

  character to the USART */Usart_senddata (USART1, (uint8_t) ch);
/* Loop until the end of transmission */while (Usart_getflagstatus (USART1, usart_flag_tc) = = RESET) {} return ch; } #ifdef Use_full_assert/** * @brief Reports The name of the source file and the source line number * wher
  E The Assert_param error has occurred.
 * @param file:pointer to the source file name * @param line:assert_param error Line source number * @retval None */void assert_failed (uint8_t* file, uint32_t line) {/* User can add his own implementation to Repor t the file name and line number, ex:printf (' Wrong parameters value:file%s on line%d\r\n ', file, line) */* INF
 Inite Loop */while (1) {}} #endif

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.