色婷婷AⅤ一区二区三区|亚洲精品第一国产综合亚AV|久久精品官方网视频|日本28视频香蕉

          新聞中心

          EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 單片機(jī)匯編實(shí)驗(yàn)七:掃描鍵盤及液晶顯示實(shí)驗(yàn)

          單片機(jī)匯編實(shí)驗(yàn)七:掃描鍵盤及液晶顯示實(shí)驗(yàn)

          作者: 時(shí)間:2016-12-01 來(lái)源:網(wǎng)絡(luò) 收藏

          ////////////////////////////////////
          //初始化液晶屏程序段
          INTE: CLR P1.1 //讀寫選擇端口清零
          CLR P2.6 //關(guān)閉數(shù)碼管
          CLR P2.7
          MOV A,#0X38
          CALL WRITE_COM
          CALL DELAY
          MOV A,#0X0E
          CALL WRITE_COM
          CALL DELAY
          CALL DELAY
          MOV A,#0X06
          CALL WRITE_COM
          CALL DELAY
          CALL DELAY
          MOV A,#0X01
          CALL WRITE_COM
          CALL DELAY
          CALL DELAY
          MOV A,#0X80
          CALL WRITE_COM
          CALL DELAY0
          RET
          //10ms延時(shí)函數(shù)
          DELAY:MOV R7,#0FFH
          DELY1:MOV R6,#02AH
          DELY2:NOP
          DJNZ R6,DELY2
          DJNZ R7,DELY1
          RET
          //5ms延時(shí)函數(shù)
          DELAY0:MOV R7,#0FEH
          DELY10:MOV R6,#02FH
          DELY20:NOP
          DJNZ R6,DELY2
          DJNZ R7,DELY1
          RET
          //寫命令函數(shù)
          WRITE_COM:
          MOV P0,A //暫定A為數(shù)據(jù)傳輸寄存器
          CLR P1.0 //打開命令選擇端口
          CLR P1.1 //打開寫選擇端口
          CLR P2.5 //液晶使能端
          CALL DELAY //10MS
          SETB P2.5 //液晶使能端
          CALL DELAY //10MS
          CLR P2.5 //液晶使能端
          RET
          // 寫數(shù)據(jù)函數(shù)
          WRITE_DATE:
          MOV P0,A //暫定A為數(shù)據(jù)傳輸寄存器
          SETB P1.0 //液晶數(shù)據(jù)/命令選擇端口
          CLR P1.1 //讀寫選擇端口
          CLR P2.5 //液晶使能端
          CALL DELAY //10MS
          SETB P2.5 //液晶使能端
          CALL DELAY //10MS
          CLR P2.5 //液晶使能端
          RET
          TABLE: DB 30H,31H,32H,33H,34H,35H,36H,37H,38H,39H,41H,42H,43H,44H,45H,46H,47H
          END

          上一頁(yè) 1 2 下一頁(yè)

          評(píng)論


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

          關(guān)閉