各位大侠: 下列程序是PC和一个下位机点对点的通信程序,我想实现PC和多个下位机的多机通信, PC下传数据格式为: 起始位,地址,命令,长度,{数据....} ,校验码 请为如何改,请高手们帮小女一下 PC又如何知道是哪个下位机上传的数据呢? 下位机通信程序 L0030H: JB RI, L0038H L0033H: CLR 00H CLR TI RETI L0038H: PUSH ACC PUSH PSW MOV A, R0 PUSH ACC MOV A, #80H ADD A, 30H MOV R0, A MOV A, SBUF JNB 0AH, L004BH AJMP L006AH L004BH: XCH A, 30H JNZ L0056H XCH A, 30H CJNE A, #7EH, L006AH XCH A, 30H L0056H: XCH A, 30H MOV @R0, A INC 30H SETB 18H MOV 31H, #14H MOV A, 30H CJNE A, #10H, L0077H MOV 30H, #00H CLR 18H L006AH: POP ACC MOV R0, A POP PSW POP ACC CLR RI JB TI, L0033H RETI L0077H: MOV A, 30H CLR C SUBB A, #04H JC L006AH MOV A, #80H ADD A, #02H MOV R0, A MOV A, @R0 ADD A, #03H CJNE A, 30H, L006AH MOV R0, #80H MOV A, #00H L008DH: XRL A, @R0 INC R0 DJNZ 30H, L008DH CLR 0EH JZ L0098H SETB 0EH L0098H: SETB 0AH CLR 18H AJMP L006AH 如有问题请联系:fmqyhm@tom.com
|