CLR A MOV RCAP2H,A MOV RCAP2L,A MOV TL2,A MOV TH2,A MOV T2MOD,A MOV T2CON,A L4: JB RXD,L4 L6: JNB RXD,L6 L7: SETB TR2 L8: JNB RXD,L10 JNB TF2,L8 L10: JNB RXD,L10 L12: JNB RXD,L14 JNB TF2,L12 L14: JNB RXD,L14 L15: CLR TR2 JB TF2,InitSerial MOV R7,TL2 MOV R6,TH2
MOV A,R6 CLR C RRC A MOV R4,A MOV A,R7 RRC A ADD A,R7 MOV R7,A MOV A,R4 ADDC A,R6 MOV R6,A
MOV A,R7 ADD A,#010H MOV R7,A CLR A ADDC A,R6 MOV R6,A
MOV A,R7 MOV R0,#05H L22: XCH A,R6 CLR C RRC A XCH A,R6 RRC A DJNZ R0,L22 MOV R7,A CLR C CLR A SUBB A,R7 MOV BRL,A CLR A MOV TL2,A MOV TH2,A MOV T2MOD,A MOV T2CON,A
ORL PCON,#080H ; set SMOD1 to double baudrate MOV BDRCON,#01EH ; set TBCK/RBCK/BRR/SPD MOV SCON,#01011010B ; Init Serial Interface
|