串口扫描两组七段码数据

 

#include<reg52.h>

#define uchar unsigned char

sbit P3_4=P3^4;

//code uchar tab[10]={0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x10,};

//code uchar tab[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,};

code uchar tab[10]={0xbf,0x06,0xdb,0xcf,0x66,0xed,0xfd,0x87,0xff,0xef,};

uchar sz[4];

int qw,bw,sw,gw,a,b,c,d;

void disp(void)

{

for(c=3;c>=0;c--)

{

SBUF=tab[sz[c]];

while(!TI);

TI=0;

}

}

void scjs(void)interrupt 3

{

TH1=0X3C;

TL1=0xB0;

a=a+1;

if(a==2)

{

a=0;

P3_4=!P3_4;

if(P3_4==0)

{

b=12;

d=13;

///yw=sz[0]=b/100000;

//ww=sz[0]=b/10000%10;

qw=sz[0]=b/10%10;

bw=sz[1]=b%10;

sw=sz[2]=d/10%10;

gw=sz[3]=d%10;

disp();

}

}

}

main()

{

TMOD=0x15;

IE=0X88;

TH1=0X3C;

TL1=0XB0;

TR0=1;

TR1=1;

a=0;

while(1);

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值