51单片机编程,要求显示学号后四位,急求
展开全部
#include<reg51.h>
#define uchar unsigned char
uchar ledtab[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xff};
uchar scan=0,disdat[4]={4,5,6,8};
void t0isr() interrupt 1
{
TH0=(65536-5000)/256;
TL0=(65536-5000)%256;
P2=1<<scan;
P0=ledtab[disdat[scan]];
scan++;
scan%=4;
}
main()
{
TMOD=0x01;
TH0=(65536-5000)/256;
TL0=(65536-5000)%256;
TR0=1;
ET0=1;
EA=1;
while(1);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询