#define uchar8 unsigned char U2_Select = P1^0; sbit SW1_Start_1 = P0^0; sbit SW1_Demomusic_2 = P0^1; uchar8 mydata = 1; void f1() { U2_Select = 0; SW1_Start_1 = 1; //运行完此句,就进入了中断 mydata = 5; SW1_Demomusic_2 = 0; }
void timer0(void) interrupt 1 { TH0 = 0xb8; TL0 = 0x00; U2_Select = 1; }
请教: SW1_Start_1 = 1 和 SW1_Demomusic_2 = 0 必须 U2_Select 为 0 才能运行的, 假设 运行完 SW1_Start_1 = 1; 就进入了中断 进入中断后,把 U2_Select 置高了,那么 出中断后,还能运行 SW1_Demomusic_2 = 0; 这句程序吗(这句程序需要 U2_Select 为低才能运行的)
谢谢!
如果不执行的话 那要怎么写啊?
bit myu2 = 0; void f1() { U2_Select = 0; SW1_Start_1 = 1; //运行完此句,就进入了中断 mydata = 5; U2_Select = 0; SW1_Demomusic_2 = 0; }
还是怎么写啊?
void timer0(void) interrupt 1 { TH0 = 0xb8; TL0 = 0x00; myu2 = U2_Select; U2_Select = 1; U2_Select = myu2; }
这样,是吗? myu2 是定义为 bit ,是吗?
谢谢!
|