;HIEN THI THEM SO NHO O HANG THU LCD_E BIT P3.4 LCD_RS BIT P3.5 LCDADDR EQU 6000H ORG 0000H MAIN: MOV DPTR,#LCDADDR ACALL CLEAR ACALL INIT_LCD ACALL DISPLAYSTRING MOV R0,#2 ;SO NHOM O HANG MOV R1,#0 ; COT ACALL GOTOXY ACALL DISPLAYNHOM SJMP $ INIT_LCD: MOV A,#38H ACALL WRITECOM MOV A,#0EH ACALL WRITECOM MOV A,#06H ACALL WRITECOM RET CLEAR: MOV A,#01H ACALL WRITECOM RET WRITECOM: MOV DPTR,#LCDADDR SETB LCD_E CLR LCD_RS MOVX @DPTR,A CLR LCD_E ACALL WAIT_LCD RET WRITETEXT: MOV DPTR,#LCDADDR SETB LCD_E SETB LCD_RS MOVX @DPTR,A CLR LCD_E ACALL WAIT_LCD RET DISPLAYSTRING: MOV A,#0 LOOP: MOV DPTR,#MESSAGE MOV R3,A MOVC A,@A+DPTR JZ EXIT ACALL WRITETEXT MOV A,R3 INC A DJNZ B,LOOP EXIT: RET DISPLAYNHOM: MOV A,#0 LAP: MOV DPTR,#MESS MOV R3,A MOVC A,@A+DPTR JZ THOAT ACALL WRITETEXT MOV A,R3 INC A DJNZ B,LAP THOAT: RET WAIT_LCD: MOV R7,#10 L1: MOV R6,#250 DJNZ R6,$ DJNZ R7,L1 RET GOTOXY: CJNE R0,#1,HANG2 ;R0 CHUA THU TU HANG MOV A,#80H BACK: ADD A,R1 ;R1 CHUA THU TU COT ACALL WRITECOM RET HANG2: MOV A,#0C0H SJMP BACK MESSAGE: DB "TU_ANH",0 MESS: DB "NHOM_1",0 END