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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > 基于AT89C2051的紅外遙控學習器源程序

          基于AT89C2051的紅外遙控學習器源程序

          作者: 時間:2010-12-09 來源:網(wǎng)絡 收藏



          ORG 0000H
          AJMP MAIN
          ORG 0003H
          AJMP KEYPRESS
          ORG 000BH
          AJMP TIMEOUT
          ORG 001BH
          AJMP TIMEOUT

          本文引用地址:http://www.ex-cimer.com/article/173092.htm

          SENDDUAN BIT P3.0
          JIEDUAN BIT P3.1
          INTRPO BIT P3.2
          JIEXUAN BIT P3.3
          SENDLIGHT BIT P3.4
          JIELIGHT BIT P3.5
          CS BIT P3.7
          DATADUAN BIT P1.6
          CLK BIT P1.7
          JIANWEI EQU R5
          JIANMA EQU R6
          SHANGJIAN EQU 07H;R7
          OPENKEY EQU 81H
          CLOSEKEY EQU 00H
          CHUT0 EQU 11H
          CHUT1 EQU 11H
          BUFBEGIN EQU 18H
          OPENT1 EQU 88H
          CLOSET1 EQU 00H
          OPENT0 EQU 82H
          CLOSET0 EQU 00H
          DATABEG1 EQU 0AAH
          DATABEG2 EQU 33H

          ORG 0030H
          MAIN: MOV IE,#80H
          MOV IP,#00H
          MOV P3,#0FFH
          CLR CS
          SETB P1.0
          SETB P1.1
          SETB P1.2
          CLR P1.3
          CLR P1.4
          CLR P1.5
          CLR P1.6
          CLR P1.7

          MOV R3,#80H
          MOV R0,00H
          CYCLE1: MOV @R0,#00H
          INC R0
          DJNZ R3,CYCLE1

          MOV PSW,#00H
          MOV SP,#07H

          MOV TMOD,#11H
          MOV TCON,#00H

          START: MOV SP,#07H
          SETB SENDDUAN
          CLR F0
          SETB EXO
          WAITKEY: MOV C,F0
          JNC WAITKEY
          CJNC JIANMA,#1BH,SEND
          LCALL LEARNP
          LJMP START
          SEND: LCALL SENDP
          LJMP START

          SENDP: SETB SENDDUAN
          CLR F0
          MOV TMOD,#CHUT1
          CLR SENDLIGHT
          MOV A,JIANMA
          CJNE A,SHANGJIAN,SAME
          SAME: MOV R0,#BUFBEGIN
          CLR TR1
          LJMP NEXT3
          RETURN: CLR ET1
          SETB SENDDUAN
          SETB SENDLIGHT
          CLR F0
          LCALL DELAY
          RET
          NEXT3: CPL F0
          JB F0,SEND1
          SEND0: CLR C ;1
          MOV A,#0FFH
          SUBB A,@R0
          MOV R2,A ;1
          INC R0 ;1
          MOV A,#0FFH ;1
          SUBB A,@R0 ;1
          MOV R3,A
          INC R0
          CLR C
          MOV A,#4FH
          ADDC A,R2
          MOV R2,A
          MOV A,R3
          ADDC A,#00H
          MOV R3,A
          MOV TL1,R2
          MOV TH1,R3
          SETB TR1 ;1
          SETB ET1 ;1
          SEND1: CLR C
          MOV A,#0FFH
          SUBB A,@RO
          MOV TL1,A
          INC R0
          MOV A,#0FFH
          SUBB A,@R0
          MOV TH1,A
          INC R0
          SETB TR1
          SETB ET1
          NEXT6: CLR SENGGUAN
          MOV R3,#03H
          NEXT4: DJNZ R3,NEXT4
          SETB SENDDUAN
          MOV R3,#07H
          NEXT5: DJNZ R3,#NEXT5
          SJMP NEXT6

          TIMA1OUT: CLR ET1 ;2
          CLR TR1 ;2
          SETB SENDDUAN ;1
          CJNE@R0,#DATABEG2,TIM1NT2
          MOV DPTR,#RETURN ;2
          MOV R1,SP ;2
          MOV @R1,DPH ;2
          DEC R1 ;1
          MOV @R1,DPL ;2
          RETI ;2
          TIM1NET2: DEC R0
          TIM1NET1: CPL F0 ;1
          JB F0,SEND11 ;2
          SEND00: MOV DPTR,#SENDO ;11
          MOV R1,SP
          MOV @R1,DPH
          DEC R1
          MOV @R1,DPL
          RETI
          SEND11: MOV DPTR,#SEND1 ;11
          MOV R1,SP
          MOV @R1,DPH
          DEC R1
          MOV @R1,DPL
          RETI
          LEARNP: MOV R2,#02H
          NEXT91: MOV R3,#0FFH
          NEXT81: MOV R4,#0FFH
          NEXT71: DJNZ R4,NEXT71
          DJNZ R3,NEXT81
          GJNZ R2,NEXT91
          CLR F0
          SETB EX0
          MOV R2,#0AH
          MEXT9: MOV R3,#0FFH
          NEXT8: MOV R4,#0FFH
          NEXT7: JB F0,NEXT10
          DJNZ R4,NEXT7
          DJNZ R3,MEXT8
          DJNZ R2,NEXT9
          CLR EX0
          RET
          NEXT10: CJNE JIANMA,#1BH,NEXT11
          LJMP NEXT111
          NEXT11: RET
          NEXT111: CLR JIELIGHT
          CLR JIEXUAN
          CLR F0
          MOV R0,#BUFBEGIN
          SETB ET0
          MOV TCON,#00H
          MOV TMOD,#CHUT0
          MOV TL0,#00H
          MOV TH0,#00H
          MOV R2,#02H
          NEXT92: MOV R3,#0FFH
          NEXT82: MOV R4,#0FFH
          NEXT72: DJNZ R4,NEXT72
          DJNZ R3,NEXT82
          DJNZ R2,NEXT92


          上一頁 1 2 3 下一頁

          評論


          相關推薦

          技術專區(qū)

          關閉
          看屁屁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); })();