;HIEN THI TEN SV LEN HANG DAU LCD_E BIT P3.4 LCD_RS BIT P3.5 LCDADDR EQU 6000H ORG 0000H MAIN: MOV @R0,30H MOV DPTR,#LCDADDR ACALL CLEAR ACALL INIT_LCD ACALL DISPLAYSTRING SJMP $ INIT_LCD: ; KHOI DONG MODULE LCD MOV A,#38H ACALL WRITECOM MOV A,#0EH ACALL WRITECOM MOV A,#06H ACALL WRITECOM RET CLEAR: ; XOA MAN HINH MOV A,#01H ACALL WRITECOM RET WRITECOM: ; GHI BYTE LENH DEN LCD MOV DPTR,#LCDADDR SETB LCD_E CLR LCD_RS MOVX @DPTR,A CLR LCD_E ACALL WAIT_LCD RET WRITETEXT: ; XUAT RA LCD MOV DPTR,#LCDADDR SETB LCD_E SETB LCD_RS MOVX @DPTR,A CLR LCD_E ACALL WAIT_LCD RET DISPLAYSTRING: ;CHON KY TU CAN HIEN THI MOV A,#0 LOOP: MOV R0,A MOV DPTR,#MESSAGE MOVC A,@A+DPTR JZ EXIT ;A=0 XUAT XONG ACALL WRITETEXT MOV A,R0 INC A DJNZ B,LOOP EXIT: RET WAIT_LCD: ; TAO TRE CHO MODULE HOAN THANH LENH HIEN THOI MOV R7,#10 L1: MOV R6,#250 DJNZ R6,$ DJNZ R7,L1 RET MESSAGE: DB "NG_TRAN_TU_ANH",0 END