LCD- Liquid Crystal Display- consists of two parallel plates between which the space is filled with liquid crystals. When you apply external voltage, the back plate transfer charge towards the front plate which opaque and display the text on screen.
16X2 LCD display 5x7 matrix on its screen using RW, RS, EN and D0-D7 pins of LCD and the black display is controlled by microcontroller.
Here is the moving text display code on 16x2 LCD and we have already discussed string display program:-
#include "REG52.h" #define LCD P0 sbit RS=P2^1; sbit RW=P2^2; sbit EN=P2^3; int i, j; void CMD(char); void DATA1(char); void display(char d[]); void display(char t[]); //**************************************** void delay(int k) // Delay Function { for(i=0;i<=100;i++) { for(j=0;j<=k;j++); } } //**************************************** void display(char d[]) // Dispaly for 1st row { for(l=0; d[l]!='';l++) { DATA(d[l]); delay(200); } } void display2(char t[]) // Display for 2nd row { CMD(0xc0); delay(200); for(l=0; t[l]!='';l++) { DATA(t[l]); delay(200); } } //*************************************** void main() // Main Function Program { while(1) { CMD(0x38); delay(); CMD(0x0E); delay(); CMD(0x01); delay(); CMD(0x14); delay(); CMD(0x85); delay(); for(z=17;z>=0;z--) { CMD(0x01); delay(2000); p=0x80|z; CMD(p); delay(1000); display("WELCOME"); display2("HOME"); CMD(0x0c); delay(15000); } } //************************************** void CMD(unsigned char c) { LCD=c; RS=0; RW=0; EN=1; for(i=0;i<=100;i++); EN=0; void DATA1(unsigned char d) { LCD=d; RS=1; RW=0; EN=1; for(i=0;i<=100;i++); EN=0; }
Comments
Post a Comment