<acronym id="xonnx"></acronym>
      <td id="xonnx"></td>
    1. <pre id="xonnx"></pre>

      1. 專注電子技術學習與研究
        當前位置:單片機教程網 >> MCU設計實例 >> 瀏覽文章

        4×4矩陣鍵盤檢測HD7279A顯示匯編程序

        作者:浪子   來源:浪子   點擊數:  更新時間:2014年06月10日   【字體:
         ORG 0000H
        LJMP  KKEYI
        ORG   0030H
          DAT1 DATA 28H
          CLK  bit  P3.0
          DAT  bit  P3.1
          CS   bit  P3.2
                 
        KKEYI:   LCALL KKS1    ; ;鍵盤信號搜索KEY SCANNING PROG
                  JNZ   KLK1       ;  有鍵盤, 轉跳 KLK1
             LCALL DELAY
                  LCALL DELAY
                  SJMP  KKEYI      ;  無鍵,轉跳 KKEYI 繼續測鍵
        K0:       MOV DAT1,A
                  LJMP  DISP
                  MOV  DAT1,#00H
                  LJMP  DISP
        KLK1:   LCALL DELAY
                LCALL DELAY
                LCALL KKS1
                JNZ   KLK2       ;  確實有鍵,轉跳至 KLK2
                LCALL DELAY
                LJMP  KKEYI
                                  ; --------------------------------------------
        KLK2:   MOV   P1,#0FEH        ; THERE IS KEYI
                  NOP
                  JB    P1.4,NOK1
                  MOV   A,#00H
                  LJMP  NUM
        NOK1:     NOP
                  JB    P1.5,NOK2
                  MOV   A,#01H
                  LJMP  NUM
        NOK2:     NOP
                  JB    P1.6,NOK3
                  MOV   A,#02H
                  LJMP  NUM
        NOK3:     NOP
                  JB    P1.7,NOK4
                  MOV   A,#03H
                  LJMP  NUM
        NOK4:     NOP
                  MOV   P1,#0FDH        ; THERE IS KEYI
                  NOP
                  JB    P1.4,NOK5
                  MOV   A,#04H
                  LJMP  NUM
        NOK5:     NOP
                  JB    P1.5,NOK6
                  MOV   A,#05H
                  LJMP  NUM
        NOK6:     NOP
                  JB    P1.6,NOK7
                  MOV   A,#06H
                  LJMP  NUM
        NOK7:     NOP
                  JB    P1.7,NOK8
                  MOV   A,#07H
                  LJMP  NUM
        NOK8:     NOP
                  MOV   P1,#0FBH        ; THERE IS KEYI
                  NOP
                  JB    P1.4,NOK9
                  MOV   A,#08H
                  LJMP  NUM
        NOK9:     NOP
                  JB    P1.5,NOKA
                  MOV   A,#09H
                  LJMP  NUM
        NOKA:     NOP
                  JB    P1.6,NOKB
                  MOV   A,#0AH
                  LJMP  NUM
        NOKB:     NOP
                  JB    P1.7,NOKC
                  MOV   A,#0BH
                  LJMP  NUM
        NOKC:     NOP
                  MOV   P1,#0F7H
                  NOP
                  JB    P1.4,NOKD
                  MOV   A,#0CH
                  LJMP  NUM
        NOKD:     NOP
                  JB    P1.5,NOKE
                  MOV   A,#0DH
                  LJMP  NUM
        NOKE:     NOP
                  JB    P1.6,NOKF
                  MOV   A,#0EH
                  LJMP  NUM
        NOKF:     NOP
                  JB    P1.7,BACK
                  MOV   A,#0FH                                 
        NUM:    MOV   DAT1,A
                  LJMP  DISP
        KKS1:     MOV   P1,#0F0H        ; IS THERE ANY
                  MOV   A,P1
                  MOV   R4,A
                  ORL   A,#0FH
                  CPL   A
                  RET
        BACK:    LJMP  KKEYI
        DISP:     MOV  29H,#0C8H
                  ACALL SEND
                  MOV  29H,DAT1
                  ACALL  SEND
                  LJMP KKEYI
        SEND:     CLR cs
                  MOV R3,#08H
                  ACALL LONG
        SEND_LOOP:MOV C,29H.7
                  MOV dat,C
                  SETB clk
                  ACALL SHORT
                  CLR clk
                  ACALL SHORT
                  MOV A,29H
                  RL A
                  MOV 29H,A
                  DJNZ R3,SEND_LOOP
                  CLR clk
                  RET
        LONG:MOV R5,#02H
        LLP:DJNZ R5,LLP
        SHORT:MOV R6,#08H
        SLP:DJNZ R6,SLP
            RET
        DELAY:MOV  R7,#08H
            LP:DJNZ  R7,LP
            RET
                END
        關閉窗口

        相關文章

        欧美性色欧美精品视频,99热这里只有精品mp4,日韩高清亚洲日韩精品一区二区,2020国自产拍精品高潮