end char equ '$'
org 0000h
ljmp main
org 0023h
ljmp serial_ser//串口中断
org 0030h
main:
mov p1,#0fh //初始化
mov tmod,#20h
mov th1,#0fdh
mov tl1,#0fdh
setb tr1
mov scon,#50h
mov dptr,#str
mov r6,#00h
mov a,r6
movc a,@a+dptr
mov ***uf,a
setb es
setb ea
sjmp $
serial_ser:
jnb ri,send
clr ri
mov a,***uf
cjne a,#31h,rets
mov p1,#0f0h
sjmp rets
send:
clr ti
inc r6
mov a,r6
movc a,@a+dptr
cjne a,#end char,sendnext
sjmp rets
sendnext:
mov ***uf,a
rets:
reti
str: db 'abcdef'//发送数据
end
end char equ '$'
org 0000h
ljmp main
org 0023h
ljmp serial_ser//串口中断
org 0030h
main:
mov p1,#0fh //初始化
mov tmod,#20h
mov th1,#0fdh
mov tl1,#0fdh
setb tr1
mov scon,#50h
mov dptr,#str
mov r6,#00h
mov a,r6
movc a,@a+dptr
mov ***uf,a
setb es
setb ea
sjmp $
serial_ser:
jnb ri,send
clr ri
mov a,***uf
cjne a,#31h,rets
mov p1,#0f0h
sjmp rets
send:
clr ti
inc r6
mov a,r6
movc a,@a+dptr
cjne a,#end char,sendnext
sjmp rets
sendnext:
mov ***uf,a
rets:
reti
str: db 'abcdef'//发送数据
end
举报