深度测评!本科生必用的9款AI论文平台全对比
2026/1/5 22:38:48
#include <reg52.h> #include <stdio.h> #include <string.h> //stdio.h,string.h用于printf函数原型 void delay(unsigned int z); void uart_init(void); //串行口初始化 void main() { int a = 6,d = 15; char b = 'A',c[] = "abcde"; uart_init(); while(1) { printf("a = %d b = %c c = %s d = %x\n",a,b,c,d); printf("hello word!\n"); printf("你好世界\n"); delay(1000); } } void uart_init(void) { TMOD=0x20; //即0010 0000,定时器/计数器1,工作方式2 TH1=0xfd; //设置波特率为9600 TL1=0xfd; TR1=1; //启动定时器/计数器1 SCON=0x50; //SM0=0;SM1=1;REN=1;0101 0000.串口工作方式1,允许串行控制 PCON=0x00; //设置SMOD=0 IE=0x90; //EA=1;ES=1;CPU允许中断,串行允许中断 TI=1; //中断请求标志位,直接使用printf必须加入此句才能实现发送 } void delay(unsigned int z) { unsigned int x,y; for(x=z;x>0;x--) for(y=110;y>0;y--); }代码写道Edit Source Code中
运行显示