Posts

Seven segment display interfacing (CA) using 8051 Micro-Controller

Image
SOFTWARE : KEIL MICRO VISION 4 SIMULATOR : PROTEUS 8.0 CIRCUIT DIAGRAM: CIRCUIT WORKING: I have used seven segment common anode display.Display is connected to 8051 through port 1. Common segment of the display is connected to VCC. It is common anode (CA) display so in order to activate segment I have provided logic 0 to respective segment (as mentioned in the table).I have connected common segment of the dispaly to VCC. PROGRAM : #include <reg51.h>  void delay(int t);  int a[10]={0x03,0x9f,0x25,0x0d,0xd9,0x49,0x41,0x1f,0x01,0x09};                         /* 7 segment CA data */  int i;  void main()  {  while(1)  {  for(i=0;i<10;i++)  { P1=a[i]; // provide data to display delay(5); }  }  } void delay(int t) // delay function  {  int i;  for(i=0;i<t*1275;i++);  }  PROGRAM DESCRIPTION: I have send the data to port 1 according to the below table. VIDEO :

LCD interfacing using 8051 Micro-Controller

Image
SOFTWARE: KEIL MICRO VISION 4.0 SIMULATOR: PROTEUS 8.0 CIRCUIT DIAGRAM: PIN DESCRIPTION OF LCD: PROGRAM: #include <reg51.h> sbit RS = P2^0; // REGISTER SELECT sbit RW = P2^1; // READ/WRITE sbit EN = P2^2; // ENABLE void delay(int t); //delay function void lcd_init(void); //initialization of lcd void lcd_command(char c); // lcd command function void lcd_data(char d); //lcd data function void str(char a[]); // lcd string function void main() // main program { lcd_init(); str("welcome"); // data to be displayed on lcd. while(1); } void lcd_init(void) { lcd_command(0x38); //8 bit,2 line,5x8 dots lcd_command(0x01); // clear display lcd_command(0x0f); //display on,cursor blinking lcd_command(0x06); lcd_comma