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 seven segment with 8051: In this tutorial seven segment display number from 0 to 9 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> void delay(int t) // function to provide delay { int i,j; for(i=0;i<t;i++) { for(j=0;j<1275;j++); } } #define PIN P2 // assigned macro "PIN" to port 2 void main() { int i=0; unsigned char arr[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; // common cathode 7 segment data array 0-9 PIN=0x00; // output port
while(1) { if(i==10){i=0;} // reset to display again array
PIN=arr[i]; // display 0-9 delay(100); // wait i++; // display next number } } >> Proteus Design Schematic: