Page 1 of 1

EB005- LCD and assembly

Posted: Wed Nov 19, 2008 3:30 am
by jgriffin
Guys,

I am attempting to display a character on the LCD using assembly language. The program use the following initialization codes:

0x33
0x32
0x2c
0x06
0x0c
0x01
0x02

This appears to work and I get a flashing cursor at postion zero.

The following code is use to send a "H" to the display.

;**** Data 'A'(48)
;****MSB
movlw 14 ; MSB first
movwf PORTB
movlw 34
movwf PORTB ; Pulse E high
movlw 14
movwf PORTB ; then low
call Sdelay
;****LSB
movlw 18 ; LSB second
movwf PORTB
movlw 38
movwf PORTB
movlw 18
movwf PORTB
call Sdelay

The "H" is not displayed and the cursor remains a position zero.

If you have a quick answer, I would appreciate it. If there is a reference I can read, let me know and I will use it.

Thanks,

Jack Griffin

Re: EB005- LCD and assembly

Posted: Fri Nov 21, 2008 2:34 pm
by Sean
Timing is one of the main issues when communicating with the LCD. Setting and clearing microcontroller outputs within a few assembler instructions of each other may result in signals that are too quick to be received correctly by the display.

I would recommend a call to a delay subroutine before any change of state on the LCD pins. Some of the delays need to be several milliseconds.

A good data sheet on the Hitachi HD44780 will contain all the necessary command and timing information.

This site seems to offer a complete introduction to PIC/LCD interfacing using 8-bit mode. It should be possible to modify the code to 4-bit mode.

http://home.iae.nl/users/pouweha/lcd/lcd2.shtml

Re: EB005- LCD and assembly

Posted: Thu Nov 27, 2008 10:50 pm
by croudyj
After initialization and before you send the H, you need a delay of at least 1.55ms. The Clear Display and Home commands take a longer time to execute than any of the others which need around 40us.

John