📄 beg8251r_s.asm
字号:
;*****************************************************************************
; Function: uart.asm
; Version : 1.00
; Description: uart
;
; Copyright Texas instruments Inc, 2000
;*****************************************************************************
.mmregs
; .global _sample_buff
;*****************************************************************************
.def _int23
.global _t8251 ,_rend,_send
;rend为接收完标志,send为发送完标志
dr8251 .set 8000h
cr8251 .set 8001h
icr .set 0ffech
.text
_int23:
nop
MAR *,AR1
sst #1,*+
sst #0,*+
sar ar0,*+
sar ar1,*+
SAR AR3,*+
sar ar4,*+
SAR AR5,*+
sacl *+
sach *+ ;以上为保护寄存器
ldp #0h
lar ar0,#0h
IN 60h,icr
nop
BIT 60h,13 ;测试INT2
bcnd SEND,NTC
; BIT 60h,12
; bcnd SEND,TC
; lar ar5,61H ;接收的数据量
RECEIVE: ldp #0h
lar ar3,6eh ;启动接收
mar *,ar3
IN *+,dr8251
nop
sar ar3,6eh
;mar *,ar5
;mar *-
;sar ar5,61h
;cmpr 0 ;判断是否已经接收了10个数
;bcnd next,ntc
;lar ar3,#(_rend) ;rend=1 则往下执行 主程序
;mar *,ar3
; splk #1h,*
; splk #00ffh,63h
;splk #0012h,60h
;out 60H,icr
next:
B end
SEND:
BIT 60h,12 ;测试INT3
bcnd end,NTC
lar ar5,64H ;发送的数据量
lar ar3,6dH ;启动串口发送
mar *,ar3
out *+,dr8251
nop
sar ar3,6dh
mar *,ar5
mar *-
sar ar5,64h
cmpr 0 ;判断是否已经发送了20个数
bcnd end,ntc
lar ar3,#(_send) ;send=1 则往下执行 主程序
mar *,ar3
splk #1h,*
splk #00ffh,63h
lar ar3,6cH
SAR AR3,6dH ;恢复t8251初始地址
splk #001dh,60h
out 60H,icr
; ldp #0h
; splk #00BBh,60h
; LAR AR5,6FH
; nop
; out 60H,dr8251
; nop
; nop
; nop
; nop
; nop
end: SPLK #003FH,ifr
in 62h,icr
nop
nop
nop
nop
out 62h,icr
MAR *,AR1
mar *-
lacc *-,16
add *-
LAR AR5,*-
nop
LAR AR4,*-
nop
LAR AR3,*-
nop
lar ar1,*
nop
mar *-
lar ar0,*-
nop
lst #0,*-
nop
lst #1,*
nop
clrc intm
ret
; .endif
;end of file. please do not remove. it is left here to ensure that no lines of code are removed by any editor
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -