| ??? 05/02/00 22:14 Read: times |
#2423 - RE: LCD-initialization. URGENT!!! |
Hi Shmulik,
Here is the one I use. This assumes an 8-bit connection of the LCD to P0 (with pullups) and RS, RD/WR, and E connected to P1.4, P1.5, & P1.6 respectively. If electrically working, the following code should produce a display on any Hitachi-type LCD. Good Luck! -Phil call InitLCD mov P0,#080h call LCDcmd mov DPTR,#Test1 mov r0,#16 call PrintText jmp $ Test1: db ' HELLO WORLD!!! ' ;--LCD Subs Follow-- InitLCD: mov P0,#30h lcall LCDcmdNB lcall LCDcmdNB lcall LCDcmdNB mov P0,#38h lcall LCDcmdNB mov P0,#01h lcall LCDcmd mov P0,#0Ch lcall LCDcmd mov P0,#080h lcall LCDcmd ret LCDcmd: clr P1.4 ;set RS low for inst clr P1.5 ;set RD/WR low for write clr P1.6 ;(STROBE) clear enable setb P1.6 ;strobe it clr P1.6 ;clear enable setb P1.5 ;set RD(H)/WR(L) high mov P0,#0FFh ;WAIT-make P0 input clr P1.4 ;set R/S low setb P1.5 ;set RD/WR high setb P1.6 ;strobe it w/ high E jb P0.7,$ ;wait while busy clr P1.6 ;clear enable ret PrintText: clr a movc a,@a+dptr mov p0,a inc dptr lcall Lcd djnz r0,PrintText ret Lcd: setb P1.4 ;set R/S high for data clr P1.5 ;set WR low clr P1.6 ;clear enable setb P1.6 ;strobe it clr P1.6 ;clear enable mov P0,#0FFh ;make P0 input clr P1.4 ;set R/S low setb P1.5 ;set RD/WR high setb P1.6 ;strobe it w/ high E jb P0.7,$ ;wait while busy clr P1.6 ;clear enable ret LCDcmdNB: clr P1.4 ;set R/S low for inst clr P1.5 ;set RD/WR low clr P1.6 ;clear enable setb P1.6 ;strobe it clr P1.6 ;clear enable setb P1.5 ;set RD(H)/WR(L) high mov B,#000h djnz B,$ ;Delays djnz B,$ djnz B,$ ret |
| Topic | Author | Date |
| LCD-initialization. URGENT!!! | 01/01/70 00:00 | |
| RE: LCD-initialization. URGENT!!! | 01/01/70 00:00 | |
| RE: LCD-initialization. URGENT!!! | 01/01/70 00:00 | |
| RE: LCD-initialization. URGENT!!! | 01/01/70 00:00 | |
| RE: LCD-initialization. URGENT!!! | 01/01/70 00:00 | |
RE: LCD-initialization. URGENT!!! | 01/01/70 00:00 |



