#include<reg51.h> sbit Led = P1^0; sbit Switch = P1^2; main() { Led = 0; Switch = 1; while(1) { if(Switch == 0) { Led = 0; } else { Led = 1; } } }