📄 uprintf.c
字号:
//--------------------------------------------------
//this is the function of send string by serial com
//no longer than MAX_DIS_NUM bytes every time
//CPU Freescale MC68HC908
//--------------------------------------------------
#include <MC68HC908MR16.h> /* include peripheral declarations */
#include <stdarg.h>
#include <stdio.h>
#include "UPrintf.h"
//EXAMPLE
//UPrintf("/*----------------*/\n\r");
//UPrintf("请选择测试的功能项:\n\r");
//UPrintf("%d\n\r",Number);
char string[MAX_DIS_NUM];
/*-------------------------------------------------*/
//Send char by the usart port
//you can change the code by diffirent type CPU
/*-------------------------------------------------*/
void Uart_SendString(char *pt)
{
while(*pt)
{
while (!(SCS1_SCTE));
SCS1_SCTE=0;
SCDR = (*pt++);
//TXBUF0=(*pt++);
}
}
/*-------------------------------------------------*/
//put char by uart
/*-------------------------------------------------*/
void UPrintf(char *fmt,...)
{
va_list ap;
va_start(ap,fmt);
(void)vsprintf(string,fmt,ap);
Uart_SendString(string);
va_end(ap);
}
/*-------------------------------------------------*/
//get char from uart
/*-------------------------------------------------*/
unsigned char UGetchar(void)
{
unsigned char getch;
while (!(SCS1_SCRF));
getch = SCDR;
return getch;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -