![](http://i1015.photobucket.com/albums/af274/vuthaitk123/fgfdgfdg_zps0870937e.jpg)
Hỏi: nhấn nút lần 1 led sáng nhấn lần 2 led tắt
while (true) { if (nut) { if (P1_0==0) P1_0=1; else P1_0=0; } }
while (true) { if (nut) { if (P1_0==0) P1_0=1; else P1_0=0; } }
#include<reg2051.h> sbit led = P1^0; void main(void) { EA = 1; //Cho phep ngat toan cuc EX0 = 1; //Cho phep ngat ngoai 0 IT0 = 1; //Cho phep ngat ngoai 0 suon am while(1); } void ngatngoai1()interrupt 0 { led = ~led; }
Comment