串行口数据转换为并行数据
时间:10-02
整理:3721RD
点击:
请问各位大神这两段程序有什么区别?
#include <reg52.h>
#include <intrins.h>
#define uint unsigned int
#define uchar unsigned char
void Delay(uint x)
{
uchar i;
while(x--)
{
for(i=0;i<120;i++);
}
}
void main()
{
uchar c = 0x80;
SCON = 0x00;
TI = 0;
while(1)
{
c = _crol_(c,1);
SBUF = c;
while(TI==1);
Delay(400);
TI = 0;
}
}
#include<reg51.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
sbit SPK=P3^7;
uchar FRQ=0x00;
//延时
void DelayMS(uint ms)
{
uchar i;
while(ms--) for(i=0;i<120;i++);
}
//主程序
void main()
{
uchar c=0x80;
SCON=0x00; //串口模式0,即移位寄存器输入/输出方式
TI=1;
while(1)
{
c=_crol_(c,1);
SBUF=c;
while(TI==0); //等待发送结束
TI=0; //TI软件置位
DelayMS(400);
}
}
#include <reg52.h>
#include <intrins.h>
#define uint unsigned int
#define uchar unsigned char
void Delay(uint x)
{
uchar i;
while(x--)
{
for(i=0;i<120;i++);
}
}
void main()
{
uchar c = 0x80;
SCON = 0x00;
TI = 0;
while(1)
{
c = _crol_(c,1);
SBUF = c;
while(TI==1);
Delay(400);
TI = 0;
}
}
#include<reg51.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
sbit SPK=P3^7;
uchar FRQ=0x00;
//延时
void DelayMS(uint ms)
{
uchar i;
while(ms--) for(i=0;i<120;i++);
}
//主程序
void main()
{
uchar c=0x80;
SCON=0x00; //串口模式0,即移位寄存器输入/输出方式
TI=1;
while(1)
{
c=_crol_(c,1);
SBUF=c;
while(TI==0); //等待发送结束
TI=0; //TI软件置位
DelayMS(400);
}
}