| ??? 08/22/03 00:59 Read: times |
#53068 - RE: 2x16 lcd: only 1 line works? Responding to: ???'s previous message |
Hello Martijn,
Try out this code snippet - I use this as a standard routine for checking new modules . 1. This is not the whole code and only the portion that transmitts the 32 characters to the LCD after Initializing. 2. This is for a memory mapped I/O scheme - but I am sure you can convert it for a direct I/O. Just get the logic from this code. 3. This code is for the Hitachi driver HD44780.( WIth the first line at 080H and second line at 0C0H ) 4. LTIME1 is just a 5ms delay routine. Use any of your own. 5. Good luck <pre> FSET EQU 38H ; L=1(8 BITS),N=1(2LINE) ; 001L N000 DCB EQU 0CH ; DIS.ON=1,CUR.OFF=0,BLINK OFF=0; 0000 1DCB CLER EQU 01H ; CLR. DISP; 0000 0001 SEM EQU 06H ; ENTRY MODE; INC=1, SHIFT=0; 0000 01IS DCON EQU 18H ; DIS & CUR CONTROL; DISSHIFT=1,LEFTWISE=0; 0001 SL00 =============== SNDLCD: ACALL LCDSET MOV A, #80H CALL LCDCOM LINE1: MOV DPTR,#TXT ; START LOADING FIRST LINE MOV R2,#16 ; 16 CHARACTERS NXT1: MOV A,#0 MOVC A,@A+DPTR ACALL LCDCHR INC DPTR DJNZ R2, NXT1 LINE2: MOV A,#0C0H ; SET ADDRESS FOR 2ND LINE ACALL LCDCOM ; WRITE TO DDRAM MOV DPTR,#TXT1 ; START LOADING 2ND LINE MOV R2,#16 NXT2: MOV A,#0 MOVC A,@A+DPTR ACALL LCDCHR INC DPTR DJNZ R2, NXT2 SJMP $ ; OVER. WAIT FOR RESET TXT: DB 'This is 1st line' TXT1: DB 'This is 2nd line' LCDSET: MOV R6,#03 TTIMES: MOV A,#FSET ACALL LCDCOM ACALL LTIME1 DJNZ R6,TTIMES ; TO SEND FSET THRICE MOV A,#DCB ACALL LCDCOM MOV A,#SEM ACALL LCDCOM MOV A,#CLER ACALL LCDCOM ACALL LTIME1 RET ;LCDCOM for writing a command to LCD. Call with required command in ACC LCDCOM: MOV P2,#ADD_H MOV R0,#LCD_C MOVX @R0,A DELAY: MOV R3,#50 ; 100 MS DELAY FOR EACH WRITE DLOOP: DJNZ R3,DLOOP RET ; LCDCHR for writing one character in DDRAM. Call with ASCII info in ACC LCDCHR: MOV P2,#ADD_H MOV R0,#LCD_D MOVX @R0,A ACALL DELAY RET END Raghu |
| Topic | Author | Date |
| 2x16 lcd: only 1 line works? | 01/01/70 00:00 | |
| little addition | 01/01/70 00:00 | |
| RE: little addition | 01/01/70 00:00 | |
| RE: little addition | 01/01/70 00:00 | |
| RE: 2x16 lcd: only 1 line works? | 01/01/70 00:00 | |
| RE: 2x16 lcd: only 1 line works? | 01/01/70 00:00 | |
| RTFM | 01/01/70 00:00 | |
| RE: RTFM- ? | 01/01/70 00:00 | |
| RE: RTFM- ? | 01/01/70 00:00 | |
| RE: RTFM- ? | 01/01/70 00:00 | |
RE: RTFM- ? | 01/01/70 00:00 | |
| RE: RTFM | 01/01/70 00:00 | |
| RE: 2x16 lcd: only 1 line works? | 01/01/70 00:00 | |
| it works now, but still some questions | 01/01/70 00:00 |



