Вы находитесь на странице: 1из 7

Interfacing Graphics LCD (GLCD) with 8051 Microcontroller by Disp...

http://www.engineersgarage.com/microcontroller/8051projects/interfac...

Search

Home

Insight

EG Labs Advertise

Articles Earn

Invention Stories Contact Us

STORE

Request Quote

Forum

Knowledge Base JOIN US ON FACEBOOK FOR LATEST UPDATES

How to display string on Graphics LCD using 8051 Microcontroller (AT89C52)


MC085 Description Circuit Diagram Video Code Code2 Components Store
Flipkart Official Site Get 1TB - 3TB Harddisks @Huge Discounts Easy EMI & Payment Option 22,177

EngineersGarage
Like

Summary ARTICLE OF THE WEEK

Humidity Sensor How Number Combination Lock Works Post and Earn

LCDs, Character, Graphic Liquid Character Displays,inverters High quality, lowest prices on line Beta Software Agreement Customizable Beta Program Toolkit. Free 30 Min Consultation. Buy Now!

/*Program to print text on Graphics LCD*/ #include<reg51.h> #include<intrins.h> #define dport P2 #include "font.h" #include "font2.h" sbit sbit sbit sbit rs=P1^0; rw=P1^1; en=P1^2; cs1=P1^3;

SHUBHAMGARG1994 Invite a friend My account Create content Log out STORE

sbit cs2=P1^4; unsigned char c; unsigned char z=0; void ctrloff() { rs=0; rw=0; en=0; cs1=0; cs2=0; } //DELAY FUNCTION void delay(unsigned int j) {

Microcontrollers (6,004) Sensors & Transducers (7,877) Development Boards (1,195) Programmers (145) Capacitors (34,783) RF Modules (300) GPS/GSM Modules (122) Zigbee (94) DC Motor (49) Stepper Motor (104)

1 of 7

03-07-2012 12:49

Interfacing Graphics LCD (GLCD) with 8051 Microcontroller by Disp...

http://www.engineersgarage.com/microcontroller/8051projects/interfac...

Gear Assembly (57) Get a Quote! }

unsigned int i; for(i=0;i<j;i++);

void displayon() { ctrloff(); dport=0x3f; cs1=1;cs2=1; rw=0;rs=0; en=1; _nop_(); en=0; } void displayoff() { ctrloff(); dport=0x3e; cs1=1;cs2=1; rs=0;rw=0; en=1; _nop_(); en=0; } void setcolumn(unsigned char y) { if(y<64) { ctrloff(); c=y; dport=0x40|(y&63); cs1=1;cs2=0; rs=0; rw=0; en=1; _nop_(); en=0; } else { c=y; dport=0x40|((y-64)&63); cs2=1;cs1=0; rs=0; rw=0; en=1; _nop_(); en=0; } } void setpage(unsigned char x) { ctrloff();

//0x40 represents Column 0

//0x40 represents Column 0

2 of 7

03-07-2012 12:49

Interfacing Graphics LCD (GLCD) with 8051 Microcontroller by Disp...

http://www.engineersgarage.com/microcontroller/8051projects/interfac...

dport= 0xb8|x; cs1=1; cs2=1; rs=0; rw=0; en=1; _nop_(); en=0; }

//0xb8 represents Page 0

//Function to Scroll Strings void setstartline(unsigned char z) { ctrloff(); dport=0xc0|z; cs1=1; cs2=1; rs=0; rw=0; en=1; _nop_(); en=0; } void lcddata(unsigned char *value,unsigned int limit) { unsigned int i; for(i=0;i<limit;i++) { if(c<64) { dport=value[i]; cs1=1;cs2=0; rs=1; rw=0; en=1; _nop_(); en=0 ; c++; } else { setcolumn(c); dport=value[i]; cs2=1;cs1=0; rs=1; rw=0; en=1; _nop_(); en=0 ; c++; } if(c>127) return; } } //0xc0 represents Line 0

3 of 7

03-07-2012 12:49

Interfacing Graphics LCD (GLCD) with 8051 Microcontroller by Disp...

http://www.engineersgarage.com/microcontroller/8051projects/interfac...

void lcdputs1(unsigned char y,unsigned char x,unsigned char *str) { unsigned char i; unsigned int a; setcolumn(y); setpage(x); for(i=0;str[i]!=0;i++) { a=(*(str+i)); a*=8; lcddata(&Character8x8[a],8); } } void lcdputs2(unsigned char y,unsigned char x,unsigned char *str) { unsigned char i; unsigned int a; setcolumn(y); setpage(x); for(i=0;str[i]!=0;i++) { a=(*(str+i)-32); a*=5; lcddata(&font5x7[a],5); } } void clrlcd() { unsigned char i,j; for (i=0;i < 8;i++) { setpage(i); setcolumn(0); for (j= 0 ;j < 128; j++) lcddata(&z,1); } } unsigned unsigned unsigned unsigned char char char char ar0[]="*************** "; ar1[]="ENGINEERSGARAGE"; ar2[]="Inspiring Creations ar3[]="************** ";

";

void main() { unsigned char i; clrlcd(); displayon(); setcolumn(0); setpage(0); lcdputs1(0,1,ar0); lcdputs1(0,2,ar1); lcdputs2(0,3,ar2); lcdputs1(0,4,ar3);

4 of 7

03-07-2012 12:49

Interfacing Graphics LCD (GLCD) with 8051 Microcontroller by Disp...

http://www.engineersgarage.com/microcontroller/8051projects/interfac...

delay(65000); delay(65000); for(i=0;i<5;i++) { displayoff(); delay(65000); displayon(); delay(65000); delay(65000); } i=0; while(1) { setstartline(i++); delay(40000); } } //Function to Scroll Strings

7798 reads

5 of 7

03-07-2012 12:49

Interfacing Graphics LCD (GLCD) with 8051 Microcontroller by Disp...

http://www.engineersgarage.com/microcontroller/8051projects/interfac...

6 of 7

03-07-2012 12:49

Interfacing Graphics LCD (GLCD) with 8051 Microcontroller by Disp...

http://www.engineersgarage.com/microcontroller/8051projects/interfac...

YOU ARE HERE Home


Copyright 2012 EngineersGarage. All rights reserved. Privacy Policy

Top

7 of 7

03-07-2012 12:49

Вам также может понравиться