基于AT89C2051的紅外遙控學習器源程序_第1頁
基于AT89C2051的紅外遙控學習器源程序_第2頁
基于AT89C2051的紅外遙控學習器源程序_第3頁
基于AT89C2051的紅外遙控學習器源程序_第4頁
基于AT89C2051的紅外遙控學習器源程序_第5頁
已閱讀5頁,還剩6頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領

文檔簡介

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

ORG0000H

AJMPMAIN

ORG0003H

AJMPKEYPRESS

ORG000BH

AJMPTIMEOUT

ORG001BH

AJMPTIMEOUT

SENDDUAN

BITP3.0

JIEDUAN

BITP3.1

INTRPO

BITP3.2

JIEXUAN

BITP3.3

SENDLIGHT

BITP3.4

JIELIGHT

BITP3.5

CS

BITP3.7

DATADUAN

BITP1.6

CLK

BITP1.7

JIANWEI

EQUR5

JIANMA

EQUR6

SHANGJIAN

EQU07H;R7

OPENKEY

EQU81H

CLOSEKEY

EQU00H

CHUT0

EQU11H

CHUT1

EQU11H

BUFBEGIN

EQU18H

OPENT1

EQU88H

CLOSET1

EQU00H

OPENT0

EQU82H

CLOSET0

EQU00H

DATABEG1

EQU0AAH

DATABEG2

EQU33H

ORG0030H

MAIN:

MOV

IE,#80H

MOV

IP,#00H

MOV

P3,#0FFH

CLR

CS

SETBP1.0

SETBP1.1

SETBP1.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

DJNZR3,CYCLE1

MOV

PSW,#00H

MOV

SP,#07H

MOV

TMOD,#11H

MOV

TCON,#00HSTART:

MOV

SP,#07H

SETBSENDDUAN

CLR

F0

SETBEXO

WAITKEY:

MOV

C,F0

JNC

WAITKEY

CJNCJIANMA,#1BH,SEND

LCALLLEARNP

LJMPSTART

SEND:

LCALLSENDP

LJMPSTARTSENDP:

SETBSENDDUAN

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

LCALLDELAY

RET

NEXT3:

CPLF0

JBF0,SEND1

SEND0:

CLRC

;1

MOVA,#0FFH

SUBBA,@R0

MOVR2,A

;1

INCR0

;1

MOVA,#0FFH

;1

SUBBA,@R0

;1

MOVR3,A

INCR0

CLRC

MOVA,#4FH

ADDCA,R2

MOVR2,A

MOVA,R3

ADDCA,#00H

MOVR3,A

MOVTL1,R2

MOVTH1,R3

SETBTR1

;1

SETBET1

;1

SEND1:

CLRC

MOVA,#0FFH

SUBBA,@RO

MOVTL1,A

INCR0

MOVA,#0FFH

SUBBA,@R0

MOVTH1,A

INCR0

SETBTR1

SETBET1

NEXT6:

CLRSENGGUAN

MOVR3,#03H

NEXT4:

DJNZR3,NEXT4

SETBSENDDUAN

MOVR3,#07H

NEXT5:

DJNZR3,#NEXT5

SJMPNEXT6TIMA1OUT:CLRET1

;2

CLRTR1

;2

SETBSENDDUAN

;1

CJNE@R0,#DATABEG2,TIM1NT2

MOVDPTR,#RETURN

;2

MOVR1,SP

;2

MOV@R1,DPH

;2

DECR1

;1

MOV@R1,DPL

;2

RETI

;2

TIM1NET2:DECR0

TIM1NET1:CPLF0

;1

JBF0,SEND11

;2

SEND00:

MOVDPTR,#SENDO

;11

MOVR1,SP

MOV@R1,DPH

DECR1

MOV@R1,DPL

RETI

SEND11:

MOVDPTR,#SEND1

;11

MOVR1,SP

MOV@R1,DPH

DECR1

MOV@R1,DPL

RETI

LEARNP:

MOVR2,#02H

NEXT91:

MOVR3,#0FFH

NEXT81:

MOVR4,#0FFH

NEXT71:

DJNZR4,NEXT71

DJNZR3,NEXT81

GJNZR2,NEXT91

CLRF0

SETBEX0

MOVR2,#0AH

MEXT9:

MOVR3,#0FFH

NEXT8:

MOVR4,#0FFH

NEXT7:

JBF0,NEXT10

DJNZR4,NEXT7

DJNZR3,MEXT8

DJNZR2,NEXT9

CLREX0

RET

NEXT10:

CJNEJIANMA,#1BH,NEXT11

LJMPNEXT111

NEXT11:

RET

NEXT111:

CLRJIELIGHT

CLRJIEXUAN

CLRF0

MOVR0,#BUFBEGIN

SETBET0

MOVTCON,#00H

MOVTMOD,#CHUT0

MOVTL0,#00H

MOVTH0,#00H

MOVR2,#02H

NEXT92:

MOVR3,#0FFH

NEXT82:

MOVR4,#0FFH

NEXT72:

DJNZR4,NEXT72

DJNZR3,NEXT82

DJNZR2,NEXT92

CLRTR0

L1:

MOVC,JIEDUAN

JCL1

L4:

SETBTR0

L2:

MOVC,JIEDUAN

CLRTR0

MOV@R0,TL0

INCR0

MOVTH0,#00H

MOVTL0,#00H

L6:

SETBTR0

L3:

MOVC,JIEDUAN

JCL3

CLRTR0

CLRC

MOVA,TL0

ADDCA,#13H

MOV@R0,A

INCR0

MOVTH0,#00H

MOVTL0,#00H

SETBTR0

L5:

MOVC,JIEDUAN

JNCL5

CLRTR0

CLRC

;1

MOVA,TL0

;1

ADDCA,#13H

;1

MOV@R0,A

;2

INCR0

MOVA,TH0

ADDCA,#00H

MOV@R0,A

INCR0

MOVTH0,#00H

MOVTL0,#00H

SJMPL6

SHUJIAN:

SETBJIEXUAN

MOV@R0,#DATABEG1

INCR0

MOV@R0,#DATABEG2

SETBEX0

CLRF0

NEXT13:

JBF0,NEXT12

LJMPNEXT13

NEXT12:

LCALLWRITEP

SETBJIELIGHT

RET

TIME0OUT

CLRET0

CLRTR0

MOVDPTR,#SHUJIAN

MOV@R1,DPH

DECR1

MOV@R1,DPL

RETI

KEYPRESS:CLREX0

MOVR3,#0DH

CYCLE3:

MOVR4,#0FFH

CYCLE2:

DJNZR4,CYCLE2

DJNZR3,CYCLE3

MOVC,INTRPO

JNCNEXT1

RETI

NEXT1:

SETBF0

MOVC,P1.0

MOVACC.0,C

MOVC,P1.1

MOVACC.1,C

MOVC,P1.2

MOVACC.2,C

CLRP1.0

CLRP1.1

CLRP1.2

SETBP1.3

SETBP1.4

SETBP1.5

MOVC,P1.3

MOVACC.3,C

MOVC,P1.4

MOVACC.4,C

MOVC,P1.5

MOVACC.5,C

ANLA,300111111B

MOVJIANMA,A

SETBP1.0

SETBP1.1

SETBP1.2

CLRP1.3

CLRP1.4

CLRP1.5

LCALLJIANWEIP

RETI

JIANWEIP:CJNEJIANMA,#36H,NEXT14

MOVJIANWEI,#01H

LJMPLAST

NEXT14:

CJNEJIANMA,#35H,NEXT15

MOVJIANWEI,#02H

LJMPLAST

NEXT15:

CJNEJIANMA,#35H,NEXT16

MOVJIANWEI,#03H

LJMPLAST

NEXT16:

CJNEJIANMA,#2EH,NEXT17

MOVJIANWEI,#04H

LJMPLAST

NEXT17:

CJNEJIANMA,#2DHNEXT18

MOVJIANWEI,#05H

LJMPLAST

NEXT18:

CJNEJIANMA,#2BH,NEXT19

MOVJIANWEL,#06H

LJMPLAST

NEXT19:

CJNEJIANMA,#1EH,NEXT20

MOVJIANWEI,#07H

LJMPLAST

NEXT20:

CJNEJIANMA,#1DH,NEXT21

MOVJIANWEL,#09H

LJMPLAST

NEXT21:

CJNEJIANMA,#1BH,NEXT22

MOVJIANWEI,#09H

LJMPLAST

NEXT22:

CLRFO

LAST:

RET

READP:

MOVRO,BUFBEGIN

MOVA,JIANWEI

MOVB,50

MULAB

MOVR3,A

SHUJUDIZHI

INCR3

LCALLREADCOM

READNET2:MOVA,R3

LCALLWRITEADRESS

LCALLREADBYTE

CJNE,#DATABEG1,READNET1

MOVAR3

INCA

LACLLWRITEADRESS

LCALLREADBYTE

CJNEA,#DATABEG2,READNET1

CLRCS

RET

READNET1:MOV@RO,A

INCRO

INCR3

LJMPREADNET2

WRITEP:

MOVRO,BUFBEGIN

MOVA,JIAWEI

MOVB,50

MUL

AB

MOVR3,A

;KAISHISHU

JUDIZHI

INCR3

LCALLEWEN

WRITNET1:LACLLWRITECOM

MOV,R3

LCALLWRITEADRESS

MOVA,@RO

CJNEA,#DATABEG1,WRITNET2

INCRO

MOVA,@RO

CJNEA,DATABEG2,WRITNET3

LCALLEWDS

CLRCS

RET

WRITNRT3:DECRO

WRITNET2:LCALLWRITEBYTE

INCRO

INCR3

LJMPWRITNE1

RET

WRITBYTE:MOVR2,#08H

BOUT1:

CLRCLK

RLCA

MOVDATADUAN,C

NOP

SETBCLK

NOPDJNZR2,BOUT1

CLRDATADUAN

RET

READBYTE:SETBDATAUAN

MOVR2,#08H

BIN1:

CLRCLK

NOP

SETBCLK

NOP

MOVC,DATADUAN

RLCA

DJNZR2,BIN1

RET

READCOM:

CLRCS

CLRCLK

SETBDATADUAN

SETBCS

NOP

SETBCLK

;1

NOP

CLRCLK

NOP

SETBCLK

;1

NOP

CLRDATAUAN

CLRCLK

NOP

SETBCLK

;0

RET

WRITECOM:CLRCS

NOP

CLRCLK

SETBDATADUAN

SETBCS

NOP

SETBCLK

;1

NOP

CLRDATADUAN

NOP

CLRCLK

NOP

SETBCLK

;0

NOP

SETBDATADUAN

NOP

CLRCLK

NOP

SETBCLK

;1

RET

WRITEADRESS:MOVR2,#07H

RLCA

;TIAOGUO

DI7WEI

BOUT2:

CLRCLK

RLCA

MOVDATADUAN,C

NOP

DJNAR2,BOUT2

CLRDATAUAN

RET

EQEN:

CLRCS

CLRCLK

SETBDATADUAN

SETBCS

SETBCLK

;1

NOP

CLRCLK

NOP

CLRDATADUAN

SETBCLK

;0

NOP

NOP

CLRCLK

NOP

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論