LCMRS EQU P2.4
LCMRW EQU P2.5LCMEN EQU P2.6LCMDATA EQU P0ORG 0000HLJMP MAINORG 0030HMAIN:MOV SP,#60HLCALL LCMSETLCALL LCMCLRMOV A,#80HLCALL LCMWR0MOV DPTR,#TAB0LCALL LCMWR2MOV A,#0C0HLCALL LCMWR0MOV DPTR,#TAB1LCALL LCMWR2SJMP $TAB0: DB "I AM YUAN MING",00HTAB1: DB "NICE TO MEET YOU",00HLCMLAY: ;读忙程序,用于判别d7是否为0PUSH ACCLOOP:CLR LCMENCLR LCMRSSETB LCMRWSETB LCMENMOV A,LCMDATACLR LCMENJB ACC.7,LOOPPOP ACCLCALL DELAYRETLCMWR0: ;写入指令LCALL LCMLAYCLR LCMENCLR LCMRSCLR LCMRWSETB LCMENMOV LCMDATA,ACLR LCMENRETLCMWR1: ;写入数据LCALL LCMLAYCLR LCMENSETB LCMRSCLR LCMRWSETB LCMENMOV LCMDATA,ACLR LCMENRETLCMWR2: 写入字符串(字符串归于数据)PUSH ACCLOOP1:CLR AMOVC A,@A+DPTRJZ LOOP2LCALL LCMWR1INC DPTRLJMP LOOP1LOOP2:POP ACCRETLCMSET: ;程序初始化MOV A,#38HLCALL LCMWR0MOV A,#08HLCALL LCMWR0MOV A,#01HLCALL LCMWR0MOV A,#06HLCALL LCMWR0MOV A,#0CHLCALL LCMWR0RETLCMCLR: ;清屏MOV A,#01HLCALL LCMWR0RETDELAY:MOV R6,#5 ;2.7MS延时子程序(效果尚不知)D1: MOV R7,#248DJNZ R7,$DJNZ R6,D1RETEND