本文包含原理图、PCB、源代码、封装库、中英文PDF等资源
您需要 登录 才可以下载或查看,没有账号?注册会员
×
#include <REGX52.H>
#include<intrins.h>
#define LEDshow P1
#define uint unsigned int
#define uchar unsigned char
uchar code table[]={0xfc,0x60,0xda,0xf2,0x66,0xb6,0xbe,0xe0,0xfe,0xf6};
sbit shuma1=P3^6;
sbit shuma2=P3^7;
sbit button1=P3^0;
sbit button2=P3^1;
sbit bu1_if=P3^2;
sbit bu2_if=P3^3;
uint num1,num2;
main()
{
TMOD=0x11;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
EA=1;
TR0=1;
TL1=(65536-50000)%256;
TH1=(65536-50000)/256;
ET1=1;
TR1=1;
button1=0;
button2=0;
while(1)
{
LEDshow=table[num1];
shuma1=0;
shuma1=1;
LEDshow=table[num2];
shuma2=0;
shuma2=1;
if(bu1_if!=0)
[color=ound-color:#ff0000] //想在此添加模块关闭中断回到主程序
}
}
timer1() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
num1++;
if(num1==10)
num1=0;
while(1)
{
LEDshow=table[num1];
shuma1=0;
shuma1=1;
LEDshow=table[num2];
shuma2=0;
shuma2=1;
if(bu1_if!=0)
ET0=0;
}
}
timer3()interrupt 3
{
if(bu2_if==0)
{
num2++;
if(num2==10)
num2=0;
TR1=0;
}
}
|