From 57bf0e54f8c602b16f8d5dfbbb4efe8c3a0f4475 Mon Sep 17 00:00:00 2001 From: IOsetting Date: Sun, 10 Jul 2022 20:54:37 +0800 Subject: [PATCH] feat: display ms&us ticks in uart demo --- demo/uart/uart1_timer1_tx.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/demo/uart/uart1_timer1_tx.c b/demo/uart/uart1_timer1_tx.c index 5d35ac3..e906d11 100644 --- a/demo/uart/uart1_timer1_tx.c +++ b/demo/uart/uart1_timer1_tx.c @@ -14,6 +14,9 @@ #include "fw_hal.h" +extern __CODE uint16_t ticks_ms; +extern __CODE uint8_t ticks_us, clkdiv; + void main(void) { SYS_SetClock(); @@ -21,9 +24,13 @@ void main(void) UART1_Config8bitUart(UART1_BaudSource_Timer1, HAL_State_ON, 115200); while(1) { - UART1_TxChar('T'); - UART1_TxHex(0x41); - UART1_TxString("U"); + UART1_TxString("ms ticks:0x"); + UART1_TxHex(ticks_ms >> 8); + UART1_TxHex(ticks_ms & 0xFF); + UART1_TxString(" us ticks:0x"); + UART1_TxHex(ticks_us); + UART1_TxString(" clock div:0x"); + UART1_TxHex(clkdiv); UART1_TxString(" string\r\n"); SYS_Delay(1000); }