#include <reg51.h> #include<stdio.h> #define uchar unsigned char #define uint unsigned int abcd(); void delay() {uchar z,i=250; while(i--) {z=255; while(z--); } } void main() { uchar i,j,temp; abcd(); EX0=1; EX1=1; PX0=1; PX1=0; IT0=1; IT1=1; EA=1; P1=0x0ff; while(1) { temp=0x01; for(i=0;i<7;i++) {P1=~temp; delay(); temp<<=1; } for(j=0;j<7;j++) {P1=~temp; delay(); temp>>=1; } } } void int0() interrupt 0 using 0 { EX0=0; P1=0x00; delay(); delay(); delay(); EX0=1; } void int1() interrupt 2 using 0 { EX1=0; P1=0x0f; while(1) {P1=~P1; delay(); } EX1=1; } abcd() {SCON=0X0F3; TMOD=0X20; TCON=0X69; TH1=0XF3; }
请帮我看下为什么我这程序在仿真时在没有外部中断也不执行主程序,而直接执行外部中断1.先谢谢了
|