利用单片机定时器0工作方式三发送字符、字符串的程序
时间:2018-09-28 09:00:01
手机看文章
扫描二维码
随时随地手机看文章
[导读]#include"STC12C5616AD.H"#define uint unsigned int#define uchar unsigned charuchar MSG[]="ilovetheworld " ;uint num;void delay(uint x){uchar i;while(x--){for(i = 0;i < 120;i++);}}void Send_char(uchar c
#include"STC12C5616AD.H"
#define uint unsigned int
#define uchar unsigned char
uchar MSG[]="ilovetheworld " ;
uint num;
void delay(uint x)
{
uchar i;
while(x--)
{
for(i = 0;i < 120;i++);
}
}
void Send_char(uchar ch)//发送单个字符
{
SBUF=ch; //送入缓冲区
while(TI!=1); //等待发送完毕
TI=0; //软件清零
}
void Send_order(uchar *p)//发送字符串
{
while(*p!='