#include<reg51.h>
sbit p=PSW^0;
unsigned char code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; unsigned char receive (void)
{
unsigned char dat;
while(RI==0);
;
RI=0;
ACC=SBUF;
if(RB8==P);
{
dat=ACC;
return dat;
}
}
void delay(unsigned int n )
{
unsigned int i,j;
for(i=0;i<n;i++)
for(j=0;j<125;j++);
}
void main(void)
{
TMOD=0X20;
SCON=0XD0;
PCON=0X00;
TH1=0XFD;
TL1=0XFD;
TR1=1;
REN=1;
while(1)
{
P1=table[receive()];
delay(400);
}
}
#include<reg51.h>
sbit p=PSW^0;
void send(unsigned char dat)
{
TB8=p;
SBUF=dat;
while(TI==0);
;
TI=0;
}
void delay(unsigned int n ) {
unsigned int i,j;
for(i=0;i<n;i++)
for(j=0;j<125;j++);
}
void main()
{
unsigned char i;
TMOD=0X20;SCON=0XC0; PCON=0X00;
TH1=0XFD;TL1=0XFD; TR1=1;
while(1)
字符串函数传参{
for(i=0;i<10;i++)
{
send(i);
delay(400);
}
}
}

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。