# Having Problem to use LCD...

#### kae23

Joined Jul 10, 2007
5
I will be used MC68HC11 for my project.......LCD will be used and the Display for the output level...my LCD type is HD47780 manucfactured by Hitachi....

Having problem to intialize the LCD.......so,

I'm really glad if anybody could help me....thanks....

#### hgmjr

Joined Jan 28, 2005
9,029
Can you describe your specific problem?

It would help if you would provide is with the code you have written to initialize the display.

hgmjr

#### hgmjr

Joined Jan 28, 2005
9,029
One of the best websites I have encountered concerning LCD displays that are HD44780 based is this link.

hgmjr

#### kae23

Joined Jul 10, 2007
5
Thank you....I still do not intialize the LCD because do not really understand....what shold be done to Initialize....After reading the data sheet ..I still do not understand....but from the link u gave me...I will try my best to do my project...thanks again...

#### hgmjr

Joined Jan 28, 2005
9,029
The HD44780 device contains a number of internal registers that require setup immediately following the application of power before the display can be used. These registers contain addresses and configuration bits that determine things like in what row and in what column the next character written to the display will be placed. Other registers contain things that tell the HD44780 how to interpret the incoming data such as whether to expect the command and/or character data to be written as an 8-bit value or two consecutive 4-bit values. There are others registers that you can read about by accessing a copy of the data sheet for the HD44780 device.

All of these registers are latches and thus their contents are not predictable over power down and power up cycles. For this reason, an initialization of these registers must be performed shortly following power-up.

You should be able to study the example code for several microcontrollers that are provided at the link from my previous post and get a good idea of how to structure your code to perform the required initialization.

Feel free to post your code here so that the members can assist as you work through any problems you encounter in developing your initialization code.

hgmjr

#### kae23

Joined Jul 10, 2007
5
I'm using Port A and Port B for my LCD. the connections to the LCD are:

RS = PA4
R/W = PA3
E = PA5

DB7 = PB7
DB6 = PB6
DB5 = PB5
DB4 = PB4
DB3 = PB3
DB2 = PB2
DB1 = PB1
DB0 = PB0

This is my initialization instructions for my LCD....but the still don't know this is correct or not....because nothing happened after downloading the instruction to my board....

PORTA EQU $1000 PORTB EQU 4 PACTL EQU 26 ORG$B600

LDS #$FF LDX #PORTA LDAA$80
STAA PACTL
START
LDAA #%00000000
STAA 0,X
BSR INI_LCD
BSR DISP
BRA START

INI_LCD

LDAA #$38 ;FUNCTION SET STAA 4,X LDY #5 BSR DELAY LDAA #$38
STAA 4,X
LDY #5
BSR DELAY
LDAA #$38 STAA 4,X LDY #5 BSR DELAY LDAA #$38 ;FUNCTION SET
STAA 4,X
LDY #5
BSR DELAY
LDAA #$06 ;ENTRY MODE STAA 4,X LDY #5 BSR DELAY LDAA #$0E ;DISPLAY ON/OFF
STAA 4,X
LDY #5
BSR DELAY
LDAA #$01 ;DISPLAY CLEAR STAA 4,X LDY #233 BSR DELAY LDAA #$80 ;SET DDRAM ADDRESS (1 LINE)
STAA 4,X
LDY #5
BSR DELAY
RTS

DISP
BSET 0,X %00010000
BSR ESTROBE
LDAA DATA
STAA 4,X
BSR ESTROBE
RTS

ESTROBE
BSET 0,X %00100000
BCLR 0,X %00100000
LDY #5
BSR DELAY
RTS

DELAY
DEY
BNE DELAY
RTS

ORG $B700 DATA FCC 'kae23' ORG$E000
FCB $7E,$B6,\$0

END

hopefully....someone will help me to overcome this problem......