<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > 1602液晶屏驅(qū)動源程序2

          1602液晶屏驅(qū)動源程序2

          作者: 時間:2011-02-27 來源:網(wǎng)絡(luò) 收藏



          ;lcd display program
          RS BIT P2.6
          R_W BIT P2.5
          ENABLE BIT P2.7
          LCDDATA DATA P1


          ;******************************************

          ORG 0000H
          AJMP MAIN
          ;ORG 000BH
          ;AJMP INSERS

          ORG 0050H
          MAIN:
          ;MOV TMOD,#00H
          ;MOV TL0,#00H
          ;MOV TH0,#00H
          ;SETB EA
          ;SETB ET0
          ;SETB TR0
          ;MOV R5,#50
          ;CLR P3.2
          ;SETB P3.1


          MOV SP,#60H
          START:
          LCALL INITIAL
          MOV A,#10000000B
          LCALL WRITE_INSTRUCTION
          MOV DPTR,#TAB
          LCALL KEY
          MOVC A,@A+DPTR
          LCALL WRITELCDDATA
          AJMP START

          ;INSERS:
          ;MOV TL0,#00H
          ;MOV TH0,#00H
          ;DJNZ R5,L0
          ;MOV R5,#50
          ;CPL P3.2
          ;CPL P3.1
          ;L0:
          ;RETI

          INITIAL:
          MOV A,#00111000B
          LCALL WRITE_INSTRUCTION
          MOV A,#00001110B
          LCALL WRITE_INSTRUCTION
          MOV A,#00000110B
          LCALL WRITE_INSTRUCTION
          RET

          CHECKBUSY:
          PUSH ACC
          CHECKBUSYLOOP:
          CLR ENABLE
          SETB R_W
          CLR RS
          SETB ENABLE
          MOV A,LCDDATA
          CLR ENABLE
          JB ACC.7,CHECKBUSYLOOP
          POP ACC
          LCALL DELAY1
          RET

          WRITE_INSTRUCTION:
          LCALL CHECKBUSY
          CLR ENABLE
          CLR R_W
          CLR RS
          SETB ENABLE
          MOV LCDDATA,A
          CLR ENABLE
          RET

          WRITELCDDATA:
          LCALL CHECKBUSY
          CLR ENABLE
          CLR R_W
          SETB RS
          SETB ENABLE
          MOV LCDDATA,A
          CLR ENABLE
          RET




          DELAY1:
          MOV R5,#05H
          L4:
          MOV R6,#0F8H
          L5:
          DJNZ R6,L5
          DJNZ R5,L4
          RET

          KEY: LCALL KS
          JNZ K1
          LCALL DELAY2
          AJMP KEY
          K1: LCALL DELAY2
          LCALL DELAY2
          LCALL KS
          JNZ K2
          AJMP KEY
          K2: MOV R2,#0DFH
          MOV R4,#00H
          K3: MOV P3,R2
          L6: JB P3.0,L1
          MOV A,#00H
          AJMP LK
          L1: JB P3.1,L2
          MOV A,#03H
          AJMP LK
          L2: JB P3.2,L3
          MOV A,#06H
          AJMP LK
          L3: JB P3.3,NEXT
          MOV A,#09H
          LK: ADD A,R4
          PUSH ACC
          K4: LCALL DELAY2
          LCALL KS
          JNZ K4
          POP ACC
          RET

          NEXT:
          INC R4
          MOV A,R2
          JNB ACC.7,KEY
          RL A
          MOV R2,A
          AJMP K3
          KS: MOV P3,#0FH
          MOV A,P3
          XRL A,#0FH
          RET
          DELAY2:
          MOV R5,#4AH
          L7: MOV R6,#0FAH
          L8: DJNZ R6,L8
          DJNZ R5,L7
          RET
          TAB:DB 31H,32H,33H,34H,35H,36H,37H,38H,39H
          DB 41H,30H,42H
          END



          評論


          相關(guān)推薦

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

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();