新聞中心

EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 51單片機(jī)驅(qū)動(dòng)1602液晶匯編語(yǔ)言程序

51單片機(jī)驅(qū)動(dòng)1602液晶匯編語(yǔ)言程序

作者: 時(shí)間:2016-11-30 來(lái)源:網(wǎng)絡(luò) 收藏
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:                              ;寫入數(shù)據(jù)LCALL LCMLAYCLR LCMENSETB LCMRSCLR LCMRWSETB LCMENMOV LCMDATA,ACLR LCMENRETLCMWR2:                           寫入字符串(字符串屬于數(shù)據(jù))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延時(shí)子程序(作用尚不知)D1:  MOV R7,#248DJNZ R7,$DJNZ R6,D1RETEND


評(píng)論


技術(shù)專區(qū)

關(guān)閉