You are on page 1of 7

10/4/12

interfacing lcd jhd162a with at89c51

Forum

Blogs

C ircuits

The ory

Tools

Se arch

Electo Tech Online User Name

Log in

W ant to re giste r? C lick he re !

Electronic Circuits and Projects Forum

Microcontrollers

8051/8951

interfacing lcd jhd162a with at89c51

Allegro IC Solutions Power & Hall-Effect Sensor ICs. Application-Specific Designs www.allegromicro.com TI's LM48511 Class D Amp 3W, Ultra Low EMI, Filterless, Mono Class D Audio Amp w/Spread Spectrum ti.com/product/LM48511 Electronic Design Service Hardware,Firmware,Software Design Customized Electronics at low costs TronicsZone.com/Electronics_Design Servo Control Tutorials Free Web Tutorials from Galil, the Leader in Servo Motor Control. www.GaliLmc.com

interfacing lcd jhd162a with at89c51


12th March 2010 09:57 AM
hiteshmadnani

#1

interfacing lcd jhd162a with at89c51 Sr. Engineer-Embedded Exp: 4-9 Years. Loc: Pune. Apply now at Naukri.com! www.Naukri.com/VLSI_Jobs Oscilloscope Manufacturer More on increasing Productivity by Tektronix oscilloscopes- Free Ebook www.tektronixindia.com
i'm have done coding but i want to display my msg for 30 sec and after that the screen should clear and a new msg should be displayed...so what should i do??? and i'm sending u my coding please check it.... DB0 EQU P1.0 DB1 EQU P1.1 DB2 EQU P1.2 DB3 EQU P1.3 DB4 EQU P1.4 DB5 EQU P1.5 DB6 EQU P1.6 DB7 EQU P1.7 EN EQU P3.7 RS EQU P3.6 RW EQU P3.5 DATA EQU P1

WAIT_LCD: CLR EN ; CLR RS ; SETB RW ; MOV DATA,#0FFh ; SETB EN ; Join our community with over 100,000 Members! It's free, easy and when MOV A,DATA ; JB ACC.7,WAIT_LCD ; you're logged in you have many more CLR EN ; features! Click to register. CLR RW RET

INIT_LCD: CLR RS MOV DATA,#38h SETB EN CLR EN LCALL WAIT_LCD CLR RS MOV DATA,#0Eh SETB EN CLR EN LCALL WAIT_LCD CLR RS MOV DATA,#06h SETB EN CLR EN LCALL WAIT_LCD www.electro-tech-online.com/8051-8951/104761-interfacing-lcd-jhd162a-at89c51.html 1/7

10/4/12

interfacing lcd jhd162a with at89c51 RET

CLEAR_LCD: CLR RS MOV DATA,#01h SETB EN CLR EN LCALL WAIT_LCD RET

WRITE_TEXT: SETB RS MOV DATA,A SETB EN CLR EN LCALL WAIT_LCD RET

LCALL INIT_LCD LCALL CLEAR_LCD MOV A,#'R' LCALL WRITE_TEXT MOV A,#'O' LCALL WRITE_TEXT MOV A,#'O' LCALL WRITE_TEXT MOV A,#'M' LCALL WRITE_TEXT MOV A,#'.' LCALL WRITE_TEXT MOV A,#'N' LCALL WRITE_TEXT MOV A,#'O' LCALL WRITE_TEXT MOV A,#'.' LCALL WRITE_TEXT MOV A,#8CH LCALL WRITE_TEXT MOV A,#'3' LCALL WRITE_TEXT MOV A,#'0' LCALL WRITE_TEXT MOV A,#'1' LCALL WRITE_TEXT CLR RS MOV DATA,#140h SETB EN CLR EN LCALL WAIT_LCD

MOV A,#'M' LCALL WRITE_TEXT MOV A,#'r' LCALL WRITE_TEXT MOV A,#'.' LCALL WRITE_TEXT MOV A,#'S' LCALL WRITE_TEXT MOV A,#'U' LCALL WRITE_TEXT MOV A,#'R' LCALL WRITE_TEXT MOV A,#'A' LCALL WRITE_TEXT MOV A,#'N' LCALL WRITE_TEXT MOV A,#'J' LCALL WRITE_TEXT MOV A,#'I' www.electro-tech-online.com/8051-8951/104761-interfacing-lcd-jhd162a-at89c51.html 2/7

10/4/12

interfacing lcd jhd162a with at89c51 LCALL WRITE_TEXT MOV A,#'T' LCALL WRITE_TEXT MOV A,#'K' LCALL WRITE_TEXT MOV A,#'O' LCALL WRITE_TEXT MOV A,#'S' LCALL WRITE_TEXT MOV A,#'T' LCALL WRITE_TEXT MOV A,#'A' LCALL WRITE_TEXT i want this msg to be displayed foe 20 sec and after that new text will be displayed waht should i right?? LCALL INIT_LCD LCALL CLEAR_LCD MOV A,#'R' LCALL WRITE_TEXT MOV A,#'O' LCALL WRITE_TEXT MOV A,#'O' LCALL WRITE_TEXT MOV A,#'M' LCALL WRITE_TEXT MOV A,#'.' LCALL WRITE_TEXT MOV A,#'N' LCALL WRITE_TEXT MOV A,#'O' LCALL WRITE_TEXT MOV A,#'.' LCALL WRITE_TEXT MOV A,#8CH LCALL WRITE_TEXT MOV A,#'3' LCALL WRITE_TEXT MOV A,#'0' LCALL WRITE_TEXT MOV A,#'2' LCALL WRITE_TEXT CLR RS MOV DATA,#140h SETB EN CLR EN LCALL WAIT_LCD

MOV A,#'M' LCALL WRITE_TEXT MOV A,#'r' LCALL WRITE_TEXT MOV A,#'.' LCALL WRITE_TEXT MOV A,#'M' LCALL WRITE_TEXT MOV A,#'A' LCALL WRITE_TEXT MOV A,#'N' LCALL WRITE_TEXT MOV A,#'I' LCALL WRITE_TEXT MOV A,#'S' LCALL WRITE_TEXT MOV A,#'H' LCALL WRITE_TEXT MOV A,#' ' LCALL WRITE_TEXT MOV A,#'Y' LCALL WRITE_TEXT MOV A,#'A' LCALL WRITE_TEXT MOV A,#'D' LCALL WRITE_TEXT www.electro-tech-online.com/8051-8951/104761-interfacing-lcd-jhd162a-at89c51.html 3/7

10/4/12

interfacing lcd jhd162a with at89c51 MOV A,#'A' LCALL WRITE_TEXT MOV A,#'V' LCALL WRITE_TEXT it will display in this format ROOM NO.301 Mr.SURANJIT KOSTA i want thi msg to be display for 30 sec and after this new msg....please help me....

17th June 2010 06:55 PM


subinalex

#2

dude....use C code....its very easier...program in micro C


0

17th June 2010 07:02 PM


subinalex

#3

here is the code.....in micro c lcd_delay() { int i; for(i=0;i<10; i++); }

lcdcommand(unsigned char cmd) { rs=0; P1=cmd; lcd_delay(); en=1; lcd_delay(); en=0; lcd_delay(); } lcddata(unsigned char dat) { rs=1; P1=dat; lcd_delay(); en=1; lcd_delay(); en=0; lcd_delay(); } lcdinitialize() { rs=0; en=0; delay1(); lcdcommand(0x38); lcdcommand(0x0e); //display on / off lcdcommand(0x01); //clear lcd display } messagedisplay(unsigned char msg[],unsigned char line) { int i; bit skip=0; if(line==1) lcdcommand(0x80); else lcdcommand(0xc0); for(i=0;i<=18;i++) www.electro-tech-online.com/8051-8951/104761-interfacing-lcd-jhd162a-at89c51.html 4/7

10/4/12

interfacing lcd jhd162a with at89c51 { if(msg[i]=='\0') skip=1; if(skip) lcddata(' '); else lcddata(msg[i]); } } unsigned unsigned unsigned unsigned unsigned unsigned char char char char char char code code code code code code msg1[] msg2[] msg3[] msg4[] msg5[] msg6[] ={" .."}; ={" hjkl "}; =(" hjghk.."); =("hgjkhgjk "); =("hjkghj.. "); =("jkkkk. ");

delay1() { long int i; for(i=0;i<100; i++); }


0

21st June 2010 10:48 AM


avisekdg

#4

can u please tell the code for code vision avr(software)...and also the connections of jhd162a with microcontroller
0

30th June 2010 11:16 AM


jakshay

#5

hi.. i am a newbie here.. i am trying to interface lcd jhd162A,However i am unable to do it properly ,i want the schematic for its connection with 89c51. the ports i am using are as follows 1 -gnd 2 -vcc 3-v0 contrast control 4-rs p 2.0 5-rw p2.1 6-e p2.2 7-to 14 d0 to d7 and d7-p3.7 15-5 for back light 16 -gnd and my code is // LCD Programming in C Liquid crystal display interfacing, lcd interfacing #include<reg51.h> #define LCD P3 /* defining commands to run */ unsigned char fset = 0x38; // Function set Interface is 8-bit long unsigned char Cursor_ON = 0x0E; // Cursor ON/OFF:: 1/0 unsigned char Clear_Lcd = 0x01; // Clear LCD unsigned char Cursor_Right = 0x06; // cursor movement to right direction unsigned char Cursor_HOME = 0x02; // Move cursor to home location unsigned char lin2=0xC0; // Second line address of cursor position unsigned char lin3=0x94; // Third line address of cursor position unsigned char lin4=0xD4; // Fourth line address of cursor position /* line1 to display on LCD */ code unsigned char *line1 = " LCD PROGRAMMING "; code unsigned char *line2 = " USING C CODE "; /* defining pins for control signals */ sbit RS = P2^0; /* register select DR/IR: 1/0*/ sbit RW = P2^1; /* read/write: 1/0 */ sbit E = P2^2; /* enable/disable:: 1/0*/ sbit busy = P3^7; /* busy checking bit */

www.electro-tech-online.com/8051-8951/104761-interfacing-lcd-jhd162a-at89c51.html

5/7

10/4/12

interfacing lcd jhd162a with at89c51 /* signatures of the function being to used*/ void init(void); /* LCD initialization function */ void writeCmd( unsigned char ); /* function to run the commands on LCD*/ void getReady(void); /* function to check either LCD free or in process i.e busy */ void writeString(unsigned char *); /* function to write data/line1 to LCD. geting a pointer parameter.*/ /* start of the main function */ void main(void) { for(; /*infiniate loop to display repeation */ { init(); /* call to initialization function*/ writeString(line1); /*sending line1 to lcd by calling writeString() function */ writeCmd(lin2); writeString(line2); /*sending line1 to lcd by calling writeString() function */ } } void init() /* init() function defination. this funcatin sends commnads to the LCD for */ { /* initialization by calling the writeCmd(unsigned char) function.*/ writeCmd(fset); writeCmd(Cursor_ON); writeCmd(Clear_Lcd); writeCmd(Cursor_Right); writeCmd(Cursor_HOME); } /* function defination for writeCmd(unsigned char) */ void writeCmd(unsigned char cmd) { getReady(); /* function for checking either is LCD not busy?*/ E = 0; /* make sure LCD not selected. that not be during initializing process*/ LCD = cmd; /* sending commmand to port3 */ RS = 0; /*Select instruction register*/ RW = 0; /* Write select control */ E = 1; E = 0; } /* Check busy bit7 of the port3: function defination */ void getReady() { E = 0; /* make sure lcd is not selected */ busy = 1; /* Make input Bit */ RS = 0; /* Command Register select */ RW = 1; /* Read from LCD */ while (busy == 1) { E = 0; E = 1; } E = 1; } /* function defination to display data on LCD*/ void writeString(unsigned char *str) { unsigned char i; unsigned int j; getReady(); E = 0; /* make sure lcd is not selected */ for(i=0;str[i]!='\0';i++) { LCD=str[i]; RS = 1; RW = 0; E = 1; E = 0; for(j = 0; j<25000; j++); } } i havent got any errors...in simulation but nothng seems to happen on my board..

www.electro-tech-online.com/8051-8951/104761-interfacing-lcd-jhd162a-at89c51.html

6/7

10/4/12

interfacing lcd jhd162a with at89c51 plz guide me thanx in advance


0

30th June 2010 11:21 AM


jakshay

#6

hello.. i have another query.. i am am unable to write a vcode for a following provblem statement// problem statement:monitor 6 indivisual pins of micro controller 89c51 such that if any pin goes high...The lcd should display a message that corresponding pin is "vacant" and if the pin goes low the lcd should display "that the pin is engaged" for ex 3.1 engaged p3.2 vacant thanx in advance
0

Tags

89c51, at89c51, coding, display, displayed, interfacing, lcd, please help me, screen, sending

Progrmmer for at89c51,89c2051,89s52 | C8051F120 Output Pins 3.3V or 5V?

Similar Threads
Thread in trouble with LC D (JHD162A) interfacing of At89c51 with PIC ds12887 interfacing with at89c51 LC D JHD162A dtn 16F628 + LC D JHD162A display problem Starter smileguitar trupti44 kiranmayi dsider akg Forum Microcontrollers Microcontrollers Microcontrollers Microcontrollers General Electronics C hat Replies 67 1 3 7 2 Last Post 8th April 2011, 03:52 PM 22nd August 2008, 08:22 AM 12th March 2007, 04:58 PM 8th June 2006, 06:39 AM 27th April 2006, 04:37 PM

Low Noise RF Amplifier IC DC to 30/45/65 GHz Order Online Now! www.centellax.com LCD Module Manufacturer for TN/STN/TFT LCM Quality & Customer oriented design www.winstar.com.tw 100% Free DataSheet (PDF) Over 20000000 DataSheet. It's Free. Multi Fast Search System. www.AllDataSheet.com
All times are GMT. The time now is 10:03 AM. Home Links Contact Us Top

Electronic Circuits | Learning Electronics


Page Time: 0.03843 seconds Memory: 7,113 KB Queries: 18 Templates: 0

www.electro-tech-online.com/8051-8951/104761-interfacing-lcd-jhd162a-at89c51.html

7/7

You might also like