单片机C语言程序设计:单片机向主机发送字符串
说明:单片机按一定的时间间隔向主机
发送字符串,发送内容在虚拟终端显示。
*/
#includereg51.h>
#define uchar unsigned char
#define uint unsigned int
//延时
void DelayMS(uint ms)
{
uchar i;
while(ms--) for(i=0;i120;i++);
}
//向串口发送字符
void Putc_to_SerialPort(uchar c)
{
SBUF=c;
while(TI==0);
TI=0;
}
//向串口发送字符串
void Puts_to_SerialPort(uchar *s)
{
while(*s!='')
{
Putc_to_SerialPort(*s);
s++;
DelayMS(5);
}
}
c语言相关文章:c语言教程
单片机相关文章:单片机教程
单片机相关文章:单片机视频教程
单片机相关文章:单片机工作原理
评论