📄 text1.c
字号:
#include<reg51.h>
sbit P3_2=P3^2;
sbit P3_3=P3^3;
sbit P1_0=P1^0;
sbit P1_1=P1^1;
sbit P1_2=P1^2;
sbit P1_3=P1^3;
sbit P1_4=P1^4;
sbit P1_5=P1^5;
void Led_on(); //function to keep leds on
void Led_off(); //function to keep leds off
void Xint0(void); //function to use extern interrupt0
void Xint1(void); //function to use extern interrupt1
main()
{
EA=1; //CPU的所有中断开
EX0=1; //外部中断开0
EX1=1; //外部中断1开
IT0=0; //INT0低电平触发
IT1=0; //INT1低电平触发
while(1){;}
}
void Xint0(void) interrupt 0
{
Led_on();
}
void Xint1(void) interrupt 2
{
Led_off();
}
void Led_on()
{
P1_0=1;
P1_1=1;
P1_2=1;
P1_3=1;
P1_4=1;
P1_5=1;
}
void Led_off()
{
P1_0=0;
P1_1=0;
P1_2=0;
P1_3=0;
P1_4=0;
P1_5=0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -