51学习笔记之使用printf打印串口数据

#include<reg51.h>
#include<stdio.h>

  
void UartInit(void)   //初始化波特率为9600
{
	SCON=0x50;   
	TMOD=0x20;
	TCON=0x40;
	TH1=0xfd;
	TI=1;
	TR1=1;
}

void main()
{
	UartInit();
	printf("hello world"); //输出一次数据
	while(1);
}
原文地址:https://www.cnblogs.com/dafang/p/5703661.html