//Get data from SWs on P1 and send it to LEDs on P2 on MDE 8051 Trainer //Tested by M. Mazidi //Modified from Examples in Chap 7 of 8051 Microcontroller book by Mazidis & McKinlay //Use wires to connect the P1 to Swiches and P2 to LEDs. //Any data on switches will go to LEDs #include void main() { unsigned char mybyte; P1=0x0FF; //P1 as input P2=0x0; //P2 as output for(;;) //do it forever { mybyte = P1; //get data from P1 P2= mybyte; //and send it to P2 } }