;串口初始化
bis.b #PENA+CHAR+SWRST,&U0CTL ;
bis.b #SSEL0+URXSE+TXWAKE,&U0TCTL ;辅助时钟
mov.b #1bh,&U0BR0 ;波特率=1200
mov.b #00h,&U0BR1 ;
mov.b #03h,&U0MCTL ;
bis.b #10h,P2SEL ; p2.4使能
bis.b #20h,P2SEL ;p2.5使能
bis.b #URXE0+UTXE0,&ME1 ;
bic.b #SWRST,&U0CTL ;
bis.b #URXE0,&IE1 ;
eint
bis.b #PENA+CHAR+SWRST,&U0CTL ;
bis.b #SSEL0+URXSE+TXWAKE,&U0TCTL ;辅助时钟
mov.b #1bh,&U0BR0 ;波特率=1200
mov.b #00h,&U0BR1 ;
mov.b #03h,&U0MCTL ;
bis.b #10h,P2SEL ; p2.4使能
bis.b #20h,P2SEL ;p2.5使能
bis.b #URXE0+UTXE0,&ME1 ;
bic.b #SWRST,&U0CTL ;
bis.b #URXE0,&IE1 ;
eint
main0 nop
nop
nop
nop
nop
nop
nop
nop
nop
jmp main0
nop
nop
nop
nop
nop
nop
nop
nop
jmp main0
chuankou0_fasong
mov.b r5,&U0TXBUF ;
reti
mov.b r5,&U0TXBUF ;
reti
chuankou0_jieshou
bic.b #URXIFG0,&IFG1 ;清除接收缓冲器满标志位(=0)
mov.b &U0RXBUF,r4 ;读取串口的接收数据
reti
bic.b #URXIFG0,&IFG1 ;清除接收缓冲器满标志位(=0)
mov.b &U0RXBUF,r4 ;读取串口的接收数据
reti