Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 #include <REG52.H> /* special function register declarations */ /* for the intended 8051 derivative */ sbit RS = P2^0; // Control signal RESET of the LCD connected to pin P2.0 sbit RW = P2^1; // Write (RW) Signal pin connected to pin P2.1 sbit EN = P2^2; // Enable (EN) LCD control signal connected to pin P2.2 //sbit T = P2^3; int i,event; void delay(void); // Delay function void INIT(void); // Function for the commands to Initialization of the LCD void ENABLE(void); // Function for the commands to enable the LCD void LINE(int); /* Function for the commands to choose the line for displaying the characters on the LCD */ void LINE(int i) // start of LINE function { if (i==1) { RS=0; // first make the reset signal low RW=0; // make RW low to give commands to the LCD P1=0x80; // force cursor to beginning of the first line ENABLE(); // enable the LCD RS=1; } else { RS=0; RW=0; P1=0xC0; // force cursor to beginning of the second line ENABLE(); RS=1; } } void delay() // Invoking the delay function. { int j,i; for (j=0;j<10;j++) { for (i=0;i<100;i++); } } void ENABLE(void) // Invoking the enable function { EN=1; // Give high to low pulse to Enable the LCD. delay(); EN=0; delay(); } void INIT(void) // Initialization of the LCD by giving the proper commands. { RS=0; RW=0; EN=0; P1 = 0x38; // 2 lines and 5.7 matrix LCD. ENABLE(); ENABLE(); ENABLE(); ENABLE(); P1 = 0x06; //Shift cursor to left ENABLE(); P1 = 0x0E; // Display ON, Cursor Blinking ENABLE(); P1 = 0x01; // Clear display Screen. ENABLE(); } void main (void) { //char code dis[11] = "KALYANA RAO"; //char code dis2[7] = "IMS/RMD"; // Array of characters to be display //char *p; // Pointer to point the data in the array. int j; while(1) { INIT(); //event=0; // scan(); LINE(1); // Display on the line 1 of the LCD. // p=&dis; // point the character address from the array ¡°dis¡± whereit is stored. for (j=0;j<11;j++) { P1=0X31; //*p++; ENABLE(); } // p=&dis2; // Point the Character address from the ¡°dis2¡± where it is stored/ // LINE(2); // Display the second array on the second line on the LCD. for (j=0;j<1000;j++); for (j=0;j<1000;j++); // { // P1=*p++; // ENABLE(); // } }//while(1) }