12-2-5.c
来自「51单片机开发与应用技术详解(珍藏版)PPT及源码」· C语言 代码 · 共 23 行
C
23 行
#include<string.h> //头文件
#include<stdio.h>
#include <reg51.h>
void main(void) //主函数
{
static char str[]="this is line 1 " //初始化字符串
"this is line2 "
"this is line 3 ";
SCON=0x50; //串口模式1,允许接收
TMOD|=0x20; //初始化T1为定时功能,模式2
PCON|=0x80; //设置SMOD=1
TL1=0xF4; //波特率4800bit/s,初值
TH1=0xF4;
IE|=0x90; //中断
TR1=1; //启动定时器
printf("str before=%s\n",str);
memmove(&str[0],&str[15],32); //调用函数
printf("str after=%s\n",str);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?