给位前辈,小弟我做的一个小试验,电路已调通,可程序不对,请各位老大指教!!(试验的内容:两个单片机通信,电路上有六个按键,我每按一个按键就让串口向另一个单片机发一串数据。我采用的是串口方式一,波特率是9600。在实际电路中测试,发现RXD总是高电平!!请分析我的程序有什么问题,是不是应该写个中断啊??应该怎么加啊??) ORG 0000H AJMP MAIN ORG 0030H MAIN: MOV TMOD,#20H MOV TL1,#0FDH MOV TH1,#0FDH SETB TR1 MOV SCON,50H KEY: MOV A, #0FFH MOV P1,A MOV A,P1 JNB ACC.0,K0 JNB ACC.1,K1 JNB ACC.2,K2 JNB ACC.3,K3 JNB ACC.4,K4 JNB ACC.5,K5 AJMP KEY K0: MOV A,#0EBH MOV SBUF,A MOV A,#67H MOV SBUF,A MOV A,#01H MOV SBUF,A MOV A,#0FBH LJMP KEY K1: MOV A,#0EBH MOV SBUF,A MOV A,#67H MOV SBUF,A MOV A,#02H MOV SBUF,A MOV A,#0FBH LJMP KEY K2:MOV A,#0EBH MOV SBUF,A MOV A,#67H MOV SBUF,A MOV A,#03H MOV SBUF,A MOV A,#0FBH LJMP KEY K3: MOV A,#0EBH MOV SBUF,A MOV A,#67H MOV SBUF,A MOV A,#04H MOV SBUF,A MOV A,#0FBH LJMP KEY K4: MOV A,#0EBH MOV SBUF,A MOV A,#67H MOV SBUF,A MOV A,#05H MOV SBUF,A MOV A,#0FBH LJMP KEY K5: MOV A,#0EBH MOV SBUF,A MOV A,#67H MOV SBUF,A MOV A,#06H MOV SBUF,A MOV A,#0FBH LJMP KEY END
|