找回密码
 注册会员
更新自动建库工具PCB Footprint Expert 2024.04 Pro / Library Expert 破解版

关于51单片机中断问题,望大侠赐教。不懂内容为下面红色标志部分

[复制链接]
admin 发表于 2012-9-2 08:42:09 | 显示全部楼层 |阅读模式

本文包含原理图、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;
}
}

49_161698_49dd83323e5fd4a.jpg
*滑块验证:
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

QQ|手机版|MCU资讯论坛 ( 京ICP备18035221号-2 )|网站地图

GMT+8, 2024-11-24 10:31 , Processed in 0.055940 second(s), 12 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表