代码;
#include "at32l021_board.h"
#include "at32l021_clock.h"
/** @addtogroup AT32L021_periph_examples
* @{
*/
/** @addtogroup 021_USART_printf USART_printf
* @{
*/
__IO uint32_t time_cnt = 0;
/**
* [url=home.php?mod=space&uid=247401]@brief[/url] main function.
* @param none
* @retval none
*/
int main(void)
{
system_clock_config();
at32_board_init();
uart_print_init(115200);
/* output a message on hyperterminal using printf function */
printf("usart printf example: retarget the c library printf function to the usart\r\n");
while(1)
{
printf("usart printf counter: %u\r\n",time_cnt++);
delay_sec(1);
}
}
效果图
|