📄 tools.c
字号:
//***********************************************************************
//FILE: tools.c
//功能: 基本的串口输入输出工具
//***********************************************************************
#include "main.h"
#include "intrins.h"
/*************************************
名称: Putchar
功能: 输出一个字节函数
*************************************/
void Putchar(unsigned char byte)
{
SBUF=byte;
while(TI==0);
TI=0;
}
/*************************************
名称: Puthexbyte
功能: 将数据用16进制的格式表示
*************************************/
void Puthexbyte(unsigned char ch)
{
unsigned char i;
i=(ch>>4);
if (i<=9) Putchar(0x30+i);
else Putchar (0x37+i);
i=(ch&0x0F);
if (i<=9) Putchar(0x30+i);
else Putchar (0x37+i);
}
/*************************************
名称: prints
功能: 打印一串字符,不超过50bytes
*************************************/
void Prints(unsigned char sMessage[26])
{
uchar k=0;
while(sMessage[k] != 0)
{
Putchar(sMessage[k]);
k++;
}
}
/****************************************************
name: delay_1s()
function: delay 1s
****************************************************/
void delay_1s()
{
uint i,j;
for(j=0;j<2;j++)
{
for(i=0;i<45000;i++)
{
_nop_();
_nop_();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -