This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

led lighting at a pin

I wrote the code for it in keil.The simulation worked perfectly but the hardware implementation for the same is not working properly.Please help

<
#include<reg51.H>
sbit IN = 0x91;
sbit OUT = 0xA1;
void main()
{ P1=0xFF;
P2=0x00;
while(P1_1==1)
{ P2_1=1;
} while(P1_1!=1)
{ P2_1=0;
} }

Parents
  • Note that delays aren't needed for this construct - the program is intended to mirror the state of a switch. And to make it work, the program should not have a while loop at end of main() - it should have the while loop encapsulate the code that checks the switch and decides if LED should be on or off.

Reply
  • Note that delays aren't needed for this construct - the program is intended to mirror the state of a switch. And to make it work, the program should not have a while loop at end of main() - it should have the while loop encapsulate the code that checks the switch and decides if LED should be on or off.

Children