8051 basic programming tutorial: In the following 8051 tutorial i used books to learn fundamental knowledge about Embedded system. After that i install Kiel compiler and Proteus simulator tool to implement following basic 8051 programming tutorial:
Interfacing of Switch with 8051: In this tutorial LED is blink using Switch using 8051(AT89C51) controller. If you want to learn more kindly see tutorial on youtube as well.
>> Switch interface with 8051 C Code: #include<reg51.h> // 8051 header file sbit LED=P2^0; // assigned macro "LED" to pin P2.0 sbit SW=P1^0; // assigned macro "SW" to pin P1.0
void main() { LED=0; // making LED output pin SW=1; // making SW as Input pin while(1) // infinite loop { LED=~SW; // If switch Open LED off, else LED ON(invert status of Switch to LED) } } >> Proteus Design Schematic: