这是串口中断服务程序 UART: PUSH ACC PUSH PSW JBC TI,OVER ;UART INTERRUPT WAIT: JBC RI,READ AJMP WAIT READ: MOV R2,#0EH MOV R0,#40H MOV A,SBUF CJNE A,30H,OUT ;SETB TB8 MOV A,#00H MOV SBUF,A DEC R2 LJMP OUT CON: ;CLR TB8 MOV A,@R0 MOV SBUF,A INC R0 LJMP OUT OVER: DJNZ R2,CON OUT: POP PSW POP ACC RETI 完成接收一个字节的任务,其中这一个字节是地址,须与存放在30H的内容一致,然后发送本机地址加24字节数据,与计算机串口调试程序调试时(用的是串口调试助手),串口收发正常。当我想收两个字节时,程序改成下面所示: 但是调试串口没反映。请帮我找出问题所在,谢谢!!
UART: PUSH ACC PUSH PSW JBC TI,OVER ;UART INTERRUPT WAIT: JBC RI,READ AJMP WAIT READ: MOV R2,#1AH MOV R0,#40H MOV A,SBUF CJNE A,30H,REC SETB 00H LJMP OUT REC: JNB 00H,OUT MOV A,SBUF MOV 80H,A CLR 00H MOV A,30H MOV SBUF,A DEC R2 LJMP OUT CON: ;CLR TB8 MOV A,@R0 MOV SBUF,A INC R0 LJMP OUT OVER: DJNZ R2,CON OUT: POP PSW POP ACC RETI |