?? infrad.asm
字號:
infcord data 23h ;the data which wait to send at the address
lowbit bit 00h ; Is it the low voltage station
Iscodebit bit 01h ; Is it the code
;-----------------------------------------------
org 0000h
ajmp Main
;------------------interupt----------------------
org 0003h
clr ex0
org 000bh
jmp Emit
org 0013h
clr ex1
org 001bh
clr et1
org 0023h
clr es
;-----------------T0 interupt-----------------
Emit: jb lowbit, iscode ; if lowbit==0 then is code else low voltage
cpl p1.0 ;generat pluse 方波 38k
iscode: djnz r7, Quit
clr tr0
Quit: reti
;-------------------Main----------------------
Main: mov sp , #60h
acall Sysini ;system initialize
Mainloop: mov c, tr0
jc Mainloop ;if Tr0==1 then emit continue else emit next bit
clr p1.0 ;do not emit
mov c, lowbit ;get the stuation of lowbit
cpl lowbit ;send the 相反的 bit
jnb lowbit, movr7 ;lowbit==0 is low voltage
mov a, infcord ;get the code
rlc a ;get one bit
mov infcord, a ;save new data
djnz r6, Gonext
mov infcord , #10100101b
mov r6, #8
Gonext: jnc Iszero
mov r7, #130
jmp Quit1
Iszero: mov r7, #43
jmp Quit1
Movr7: mov r7, #42
Quit1: setb tr0
ajmp Mainloop
;---------------------------------------------
Sysini: mov tmod, #00000010b ;8 bit auto lode
mov ie, #10000010b ;enable T0
mov infcord, #10100101b ; code
mov r6, #8 ;turn left 8 times
mov r7, #43 ;low voltage time
mov th0, #243 ; repeat data
mov tl0, #243 ; initialize value
setb tr0 ; start T0
ret
;---------------------------------------------
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -