Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

What is the init code for 1 X 16 LCD?

Status
Not open for further replies.

Navid T

Full Member level 3
Joined
Jan 21, 2005
Messages
186
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,296
Location
Iran
Activity points
1,385
about 1 X 16 LCD

hello
whats init code for "1 X 16" LCD?
thank you
Navid
 

about 1 X 16 LCD

Init code is the same with 2x16 LCD, limit is that you cannot use the 2nd row because your LCD hardware is only 1x16.
 

Re: about 1 X 16 LCD

These are usually electrically configured as 2x8 with the second row starting at 0x40.
 

Re: about 1 X 16 LCD

Navid T said:
hello
whats init code for "1 X 16" LCD?
thank you
Navid

what do you mean? intial for programming the LCD for display
i guess in any language the LCD is quite slow so it must be giving some delay for the LCD to initalizaiton usally 500 us
 

Re: about 1 X 16 LCD

Hello!

Here is my code for 16x1:

Code:
//fonction d'initialisation de l'écran
void initlcd (void)
{
   LCDdata = 0b00000000;   //toutes les pins de données à 0
   LCDrw = 0;
   LCDenable = 0;         //enable à 0
   LCDrs = 0;            //Register Select à 0 (configuration)   

   longwait;

   //display ON
   LCDdata = 0b00001111;
   wait;
   LCDenable = 1;
   wait;
   LCDenable = 0;
   wait;

   // mode 8 bit
   LCDdata = 0b00000001;   
   wait;
   LCDenable = 1;
   wait;
   LCDenable = 0;
   wait;

   // effacer l'écran
   LCDdata = 0b00111000;   
   wait;
   LCDenable = 1;
   wait;
   LCDenable = 0;
   wait;
}

//fonction pour choisir entre quelle ligne d'écran
void line (int x)
{
	if (x == 1)
	{
	    //set display adress au début de l'écran (ligne 1)
   	    LCDrs = 0;
 		LCDrw = 0;
		LCDdata = 0x80;   
  		wait;
 		LCDenable = 1;
		wait;
   		LCDenable = 0;
   		wait;
	}

	if (x == 2)
	{
		//set display adress au 9e charactère (ligne 2)
   	    LCDrs = 0;
		LCDrw = 0;
       	LCDdata = 0xC0;   
   		wait;
   		LCDenable = 1;
   		wait;
   		LCDenable = 0;
   		wait;
	}
}

//configuration de l'écran (efface, home, etc)
void configuration (int config)
{
	if (config == 1)
	 {
		//efface l'écran
   	    LCDrs = 0;
		LCDdata = 0b00000001;   
  		wait;
 		LCDenable = 1;
		wait;
   		LCDenable = 0;
   		wait;	
	 }

	if (config == 2)
	 {
		//curseur et écran home
		LCDrs = 0;
		LCDdata = 0b00000011;   
  		wait;
 		LCDenable = 1;
		wait;
   		LCDenable = 0;
   		wait;	
	 }

	if (config == 3)
	 {
		//curseur ON
		LCDrs = 0;
		LCDdata = 0b00001111;   
  		wait;
 		LCDenable = 1;
		wait;
   		LCDenable = 0;
   		wait;
	 }

	if (config == 4)
	 {
		//curseur OFF
		LCDrs = 0;
		LCDdata = 0b00001100;   
  		wait;
 		LCDenable = 1;
		wait;
   		LCDenable = 0;
   		wait;
	 }
}[quote]

Hope this help!

JFDuval
[/code]
 

Re: about 1 X 16 LCD

8051 code for 2*40 character lcd.11.0592MHZ XTAL.

LCD_E BIT P2.7 ;LCD ENABLE
LCD_RW BIT P1.7 ;LCD RW
LCD_RS BIT P1.6 ;LCD RS
LCD_BF BIT P0.7 ;LCD BUSY


;********
LCD_INIT:
;********
CALL DELAY5MS
CALL DELAY5MS
CALL DELAY5MS
MOV A,#00110000B ;FONCTION SET 8 BIT DATA
CALL LCD_C_WRITE
CALL DELAY5MS
MOV A,#00110000B
CALL LCD_C_WRITE
CALL DELAY100MIC
;BUSY
MOV A,#00110000B
CALL LCD_C_WRITE
MOV A,#00111000B ;2 LINE FONT 5*10
CALL LCD_C_WRITE
MOV A,#00001100B ;DISPLEY ON,NO CURSER,NO BLINK CHR
CALL LCD_C_WRITE
MOV A,#00000001B ;CLEAR ALL DISP CURSOR HOME
CALL LCD_C_WRITE
MOV A,#00000110B ;AUTO INC,NO SHIFT
CALL LCD_C_WRITE
RET

;********
LCD_BUSY:
;********
SETB LCD_BF
SETB LCD_RW
CLR LCD_RS
SETB LCD_E
CALL DELAY10MICROSEC
;ıIF BIT7=1 LCD BUSY
WAIT:
JB LCD_BF,WAIT
CLR LCD_E
RET
;********
LCD_C_WRITE:
;********
;INPUT ACC
CLR LCD_RW
CLR LCD_RS
SETB LCD_E
CALL DELAY10MICROSEC
MOV P0,A ;LCD DATA
CLR LCD_E
CALL LCD_BUSY
RET
;********
LCD_WRITE:
;********
;INPUT ACC
CLR LCD_RW
SETB LCD_RS
SETB LCD_E
CALL DELAY10MICROSEC
MOV P0,A ;LCD DATA
CLR LCD_E
CALL DELAY10MICROSEC
CALL LCD_BUSY
RET
;********
POINTER_LEFT:
;********
MOV A,#00010000B
CALL LCD_C_WRITE
RET
;********
SETCURSER:
;********
CLR LCD_RS
CLR LCD_RW
SETB ACC.7
CALL LCD_C_WRITE
CALL LCD_BUSY
RET
;********
SHOWMSG:
;********
MOV R7,#20
NEXCHRM:
CLR A
MOVC A,@A+DPTR
CALL LCD_WRITE
INC DPTR
INC A
DJNZ R7,NEXCHRM
RET
;********
LCD_CLEAR:
;*****
MOV A,#01H
CALL LCD_C_WRITE
RET
 

Re: about 1 X 16 LCD

when i write my program bye assembly and mov 38 for init code, only my 8 carechters are enabled but when i writ it by basic it work properly, i think its problem of my init code , how do you think?
thank you
 

Re: about 1 X 16 LCD

look at this file it will help you
you have to write your first 8bit at address 0x80 and then write your next 8bit to address 0xc0
good luck
 

Re: about 1 X 16 LCD

hello
thank you for your help but i cant see any file here!!! why?
 

Re: about 1 X 16 LCD

you can go to have a look on this website.... it helps me alot.... hope it'll help you too...

www.winpicprog.co.uk
 

Re: about 1 X 16 LCD

you have to login first to see the file its in pdf format
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top