뭐... 각설 하고,,
걍 소스 올립니다.
#include <stdio.h>
#include <string.h> // memset, strncmp 때문에 추가.
#include <stdarg.h>
void TX1_char(unsigned char c) {
UART_WRITE(UART1,c);
while(!(UART1->FIFOSTS & UART_FIFOSTS_TXEMPTYF_Msk));
}
void TX1_string(char *s){
while(*s != '\0'){
TX1_char(*s);
s++;
}
}
void print1f(const char* format, ...){
char buf[1000];
va_list args;
memset(buf, 0, sizeof(buf));
va_start(args, format);
vsprintf(buf, format, args);
va_end(args);
TX1_string(buf);
}
int32_t main(void)
{
print1f("HanGeul %03d HONG GilDong\n" , 5);
}
/* Result
HanGeul 005 HONG GilDong
*/
debug port 로 0 을 쓰든 1을 쓰든 하는데, 가끔 또 다른 포트로 print 하고 싶을때... 쓰셔요..
'개발 > Nuvoton' 카테고리의 다른 글
| gcc 로 nuvoton source 직접 build(compile) 하기 (0) | 2025.01.20 |
|---|---|
| Nuvoton 제공 Sample Code를 Keil 에서 Compile 하기 (0) | 2025.01.10 |
| nuvoton (offline) download (1) | 2023.12.08 |
| nuvoton-M483 PWM 으로 Nec 방식 IrDA 수신기, example source (0) | 2023.11.09 |
| Nuvoton M483 i2c + RV3028 (RTC) IRQ , 고정밀 RTC 비교, sample source (0) | 2023.08.07 |