KK: JNB 26H.0,KK1 NOP ;STOP DJNZ 71H,KK01 CALL ST CLR EA JMP WA KK01: JNB 24H.3 ,KK02 CALL ST RET KK02: SETB 23H.7 CLR 23H.6 ; CLR 20H.3 RET KK1: JNB 26H.6,KK2 NOP ;RUN SETB 23H.6 CLR 23H.7 KK0: RET KK2: JNB 26H.4,KK3 JB 27H.4,KK0 SETB 27H.4 INC 15H MOV A,#04 ;;;;; JB 21H.2,KK21 MOV A,#06 KK21: CJNE A,15H,KM MOV 15H,#01 CLR 27H.0 JMP KM ;MODE KK3: JNB 26H.7,KK4 JB 27H.5,KK0 SETB 27H.5 ;ENT JMP KE KK4: JNB 26H.5,KK5 ; JB 27H.6,KK0 ; SETB 27H.6 ;^ JMP KS KK5: JNB 26H.3,KK6 ; JB 27H.7,KK0 ; SETB 27H.7 ;v JMP KX KK6: ANL 27H,#00001111B MOV 13H,#0 MOV 14H,#1 MOV 70H,#10 MOV 71H,#250 JNB 27H.1,KK61 CLR 27H.1 MOV R0,#4AH MOV R2,#00H MOV R3,#2 CALL I2CW KK61: RET
KM: JB 20H.3,KK61 MOV A,15H CJNE A,#1,KM1 MOV R2,50H ;H MOV R3,51H MOV 1CH,#00H MOV 12H,#1 SETB 20H.6 JMP KM00
KM1: CJNE A,#2,KM2 ;F MOV A,78H CJNE A,#0,KM11 MOV R2,4AH ;0F MOV R3,4BH KM10: MOV 1CH,#00H MOV 12H,#2 SETB 20H.6 JMP KM00 KM11: CJNE A,#1,KM12 MOV R2,56H ;1F MOV R3,57H JMP KM10
KM12: CJNE A,#2,KM13 MOV R2,4AH ;2F MOV R3,4BH JMP KM10
KM13: CJNE A,#3,KM14 MOV R2,56H ;3F MOV R3,57H JMP KM10
KM14: MOV R2,5CH ;4F MOV R3,5DH JMP KM10
KM2: CJNE A,#3,KM3 MOV A,7BH ;A MOV B,42H MUL AB RLC A MOV A,B RLC A MOV R3,A CLR A RLC A MOV R2,A MOV 1CH,#00H MOV 12H,#3 SETB 20H.6 JMP KM00
KM3: CJNE A,#4,KM4 ;Pr JB 27H.0,KM01 MOV 1CH,#00H MOV 12H,#4 CLR 20H.6 JMP KS23
KM4: CJNE A,#5,KM0 ;E MOV R2,#00H MOV R3,40H MOV 1CH,#00H MOV 12H,#5 CLR 20H.6 JMP KM00 KM0: RET
KM00: CLR 27H.0 KM02: CALL BTD CALL DIR RET KM01: JMP KS4 MOV R2,10H MOV R3,11H JMP KM02
KE: MOV A,15H CJNE A,#4,KE1 CPL 27H.0 JNB 27H.0,KE2 MOV A,16H ADD A,16H MOV R2,A MOV R0,#10H MOV R3,#2 CALL I2CR MOV 12H,#0 JMP KS4 KE1: RET KE2: MOV A,16H CJNE A,#33,KE21 MOV A,11H JZ KE21 JB 21H.2,KE21 CALL RK0 CALL RA MOV 12H,#00H MOV 18H,#00H MOV 19H,#39H MOV 1AH,#3FH MOV 1BH,#5BH RET KE21: ADD A,16H MOV R2,A MOV R0,#10H MOV R3,#2 CALL I2CW JMP KS23
KS11: MOV 14H,#50 JMP KS12 KS1: CJNE A,#2,KS2 JMP KS10 KS0: RET KS: MOV A,15H CJNE A,#1,KS1 KS10: DJNZ 14H,KS0 DJNZ 70H,KS11 MOV 70H,#1 MOV 14H,#5 KS12: MOV A,4BH ADD A,#1 MOV 4BH,A MOV A,4AH ADDC A,#0 MOV 4AH,A MOV R4,4AH MOV R5,4BH MOV R6,58H MOV R7,59H CALL WMP2 JB 21H.1,KS13 MOV 4AH,58H MOV 4BH,59H KS13: MOV R2,4AH MOV R3,4BH SETB 27H.1 CALL BTD CALL DIR RET
KS21: MOV 14H,#100 JMP KS22
KS2: CJNE A,#4,KS0 DJNZ 14H,KS0 DJNZ 70H,KS21 MOV 70H,#1 MOV 14H,#50 KS22: JB 27H.0,KS3 MOV A,16H ADD A,#1 MOV 16H,A CLR C SUBB A,#33 JC KS23 MOV 16H,#00 KS23: MOV R2,#00H MOV R3,16H MOV 12H,#4 CALL BTD CALL DIR RET
KS3: INC 13H MOV A,13H CJNE A,#11,$+3 JNC KS31 MOV A,11H ADD A,#1 MOV 11H,A MOV A,10H ADDC A,#0 MOV 10H,A JMP KS4 KS31: CJNE A,#20,$+3 JNC KS32 MOV A,11H ADD A,#10 MOV 11H,A MOV A,10H ADDC A,#0 MOV 10H,A JMP KS4
KS32: MOV 13H,#20 MOV A,11H ADD A,#100 MOV 11H,A MOV A,10H ADDC A,#0 MOV 10H,A JMP KS4 KS4: MOV DPTR,#KKB MOV A,16H MOV B,#8 MUL AB ADD A,DPL MOV DPL,A MOV A,B ADDC A,DPH MOV DPH,A MOV A,#2 MOVC A,@A+DPTR MOV R4,A MOV A,#3 MOVC A,@A+DPTR MOV R5,A MOV R6,10H MOV R7,11H CALL WMP2 JB 21H.0,KS41 MOV 10H,R4 MOV 11H,R5 KS41: MOV A,#7 MOVC A,@A+DPTR MOV C,ACC.0 MOV 20H.6,C MOV R2,10H MOV R3,11H CALL BTD CALL DIR RET
KX0: RET KX1: CJNE A,#2,KX2 JMP KX10 KX11: MOV 14H,#100 JMP KX12 KX: MOV A,15H CJNE A,#1,KX1 KX10: DJNZ 14H,KX0 DJNZ 70H,KX11 MOV 70H,#1 MOV 14H,#5 KX12: MOV A,4BH CLR C SUBB A,#1 MOV 4BH,A MOV A,4AH SUBB A,#0 MOV 4AH,A JNC KX14 MOV 4AH,#00 MOV 4BH,#00 KX14: MOV R2,4AH MOV R3,4BH SETB 27H.1 CALL BTD CALL DIR RET KX21: MOV 14H,#100 JMP KX22
KX2: CJNE A,#4,KX0 DJNZ 14H,KX0 DJNZ 70H,KX21 MOV 70H,#1 MOV 14H,#50 KX22: JB 27H.0,KX3 MOV A,16H CLR C SUBB A,#1 MOV 16H,A JNC KX31 MOV 16H,#33 KX23: MOV R2,#00H MOV R3,16H MOV 12H,#4 CALL BTD CALL DIR RET
KX3: INC 13H MOV A,13H CJNE A,#11,$+3 JNC KX31 MOV A,11H CLR C SUBB A,#1 MOV 11H,A MOV A,10H SUBB A,#0 MOV 10H,A JMP KX4 KX31: CJNE A,#20,$+3 JNC KX32 MOV A,11H CLR C SUBB A,#10 MOV 11H,A MOV A,10H SUBB A,#0 MOV 10H,A JMP KX4
KX32: MOV 13H,#20 MOV A,11H CLR C SUBB A,#100 MOV 11H,A MOV A,10H SUBB A,#0 MOV 10H,A JMP KX4 KX4: MOV DPTR,#KKB MOV A,16H MOV B,#8 MUL AB ADD A,DPL MOV DPL,A MOV A,B ADDC A,DPH MOV DPH,A CLR A MOVC A,@A+DPTR MOV R4,A MOV A,#1 MOVC A,@A+DPTR MOV R5,A MOV A,#7 MOVC A,@A+DPTR MOV C,ACC.0 MOV 20H.6,C MOV A,10H JB ACC.7,KX41 MOV R6,A MOV R7,11H CALL WMP2 JB 21H.1,KX42 KX41: MOV 10H,R4 MOV 11H,R5
KX42: MOV R2,10H MOV R3,11H CALL BTD CALL DIR RET
ADC: ANL ADCON1,#11111000B ;AN0 VG NOP NOP NOP INC ADDATL ADC1: NOP JB ADCON0.4,ADC1 CLR IADC MOV 4EH,ADDATH MOV 4FH,ADDATL ORL ADCON1,#00000001B ;AN1 VA NOP NOP NOP INC ADDATL ADC2: NOP JB ADCON0.4,ADC2 CLR IADC MOV 42H,ADDATH MOV 43H,ADDATL ORL ADCON1,#00000111B ;AN7 VDC NOP NOP NOP INC ADDATL ADC3: NOP JB ADCON0.4,ADC3 CLR IADC MOV 40H,ADDATH MOV 41H,ADDATL RET
O95: DJNZ 17H,O96 MOV 17H ,#5 I65: MOV R0,#8 SETB P3.0 I66: CLR P2.6 MOV C,P3.0 RLC A SETB P2.6 NOP DJNZ R0,I66 CPL A ANL A,#0FFH MOV R1,A XRL A,77H JNZ I67 MOV 26H,77H JMP O96 I67: MOV 77H,R1 O96: ; CLR P3.5 ;SY CLR P2.5 ;NMDVF MOV R0,#08 MOV A,17H ADD A,#2 MOVC A,@A+PC SJMP O97 DB 11111111B DB 11111110B DB 11111101B DB 11111011B DB 11110111B DB 11101111B DB 11111111B DB 11111111B O97: CLR P2.6 RLC A MOV P3.1,C NOP NOP NOP NOP SETB P2.6 DJNZ R0,O97 MOV A,17H ADD A,#17H MOV R0,A MOV A,@R0 MOV R0,#08H ;ACCA=HC595 O98: CLR P2.6 RLC A MOV P3.1,C NOP NOP NOP NOP SETB P2.6 DJNZ R0,O98 CLR P3.1 ; SETB P3.5 ;SY SETB P2.5 ;NMDVF RET
M2UL: MOV A,R2 ;R2R3*R6R7=R4R5R6R7 XRL A,R6 MOV C,ACC.7 MOV F0,C MOV A,R2 CLR ACC.7 MOV R2,A MOV A,R6 CLR ACC.7 MOV R6,A MOV A,R3 MOV B,R7 MUL AB XCH A,R7 MOV R5,B MOV B,R2 MUL AB ADD A,R5 MOV R4,A CLR A ADDC A,B MOV R5,A MOV A,R6 MOV B,R3 MUL AB ADD A,R4 XCH A,R6 XCH A,B ADDC A,R5 MOV R5,A MOV 21H.0,C MOV A,R2 MUL AB ADD A,R5 MOV R5,A CLR A MOV ACC.0,C MOV C,21H.0 ADDC A,B MOV C,F0 MOV ACC.7,C MOV R4,A RET
DIVL: MOV A,R3 ;R2R3R4R5/R6R7 CLR A ;=R4R5 SUBB A,R7 MOV A, R2 SUBB A,R6 JNC DIVE1 MOV B,#16 DIV1: CLR C MOV A,R5 RLC A MOV R5,A MOV A,R4 RLC A MOV R4,A MOV A,R3 RLC A MOV R3,A XCH A,R2 RLC A XCH A,R2 MOV F0,C CLR C SUBB A,R7 MOV R1,A MOV A,R2 SUBB A,R6 JB F0,DIV2 JC DIV3 DIV2: MOV R2,A MOV A,R1 MOV R3,A INC R5 DIV3: DJNZ B,DIV1 CLR F0 RET DIVE1: SETB F0 RET
A2DD: MOV A,R4 ;R4R5+R6R7=R4R5 MOV C,ACC.7 MOV F0,C MOV A,R6 MOV C,ACC.7 MOV 21H.0,C XRL A,R4 MOV C,ACC.7 MOV A,R4 CLR ACC.7 MOV R4,A MOV A,R6 CLR ACC.7 MOV R6,A JC DAB2 MOV A,R5 ADD A,R7 MOV R5,A MOV A,R4 ADDC A,R6 MOV R4,A JB ACC.7,DABE DAB1: MOV C,F0 MOV ACC.7,C MOV R4,A MOV C,21H.0 MOV A,R6 MOV ACC.7,C MOV R6,A CLR C RET
DABE: SETB C RET DAB2: MOV A,R5 CLR C SUBB A,R7 MOV R5,A MOV A,R4 SUBB A,R6 MOV R4,A JNB ACC.7,DAB1 MOV A,R5 CPL A ADD A,#1 MOV R5,A MOV A,R4 CPL A ADDC A,#0 MOV R4,A CPL F0 SJMP DAB1
WMP2: MOV A, R4 ;R4R5>R6R7 21H.0=1 CJNE A,6H,WMP21 ;R4R5<R6R7 21H.1=1 MOV A, R5 ;R4R5=R6R7 21H.0=0 21H.1=0 CJNE A,7H,WMP21 CLR 21H.0 CLR 21H.1 RET WMP21: MOV 21H.1,C CPL C MOV 21H.0,C RET
BTD: CLR A ;R2R3.B=R4R5R6.BCD MOV R4,A MOV R5,A MOV R6,A MOV R7,#16 BTD1: CLR C MOV A,R3 RLC A MOV R3,A MOV A,R2 RLC A MOV R2 ,A MOV A,R6 ADDC A,R6 DA A MOV R6,A MOV A,R5 ADDC A,R5 DA A MOV R5,A MOV A,R4 ADDC A,R4 DA A MOV R4,A DJNZ R7,BTD1 RET
DTB: MOV R2,#3 ;@R0+1+1+1.BCD= MOV R3,#0 ;R3R4.B MOV A,@R0 MOV R4,A DTB1: MOV A,R4 MOV B,#10 MUL AB MOV R4,A MOV A,#10 XCH A,B XCH A,R3 MUL AB ADD A,R3 XCH A,R4 INC R0 ADD A,@R0 XCH A,R4 ADDC A,#0 MOV R3,A DJNZ R2,DTB1 RET
DIR01: SWAP A CALL RDIR MOV 19H ,A MOV A,R5 ANL A,#0FH CALL RDIR MOV 1AH,A MOV A,R6 ANL A,#0F0H SWAP A CALL RDIR MOV 1BH ,A JMP DIR02 DIR: MOV A,R5 ANL A,#0F0H JB 27H.0,DIR00 JNZ DIR01 DIR00: SWAP A CALL RDIR MOV 18H ,A MOV A,R5 ;R4R5R6=18H19H1AH1BH; 20H.6=DP ANL A,#0FH ;12H ,0= ,1=H, 2=F, 3=A, 4=Pr CALL RDIR ;5=E MOV 19H ,A MOV A,R6 ANL A,#0F0H SWAP A CALL RDIR MOV C,20H.6 MOV ACC.7,C MOV 1AH,A MOV A,R6 ANL A,#0FH CALL RDIR MOV 1BH ,A DIR02: MOV A,12H CJNE A,#1,DIR1 MOV 18H,#76H ;H JMP DIR2 DIR1: CJNE A,#2,DIR11 MOV 18H,#71H ;F JMP DIR2 DIR11: CJNE A,#3,DIR12 MOV 18H,#77H ;A JMP DIR2 DIR12: CJNE A,#4,DIR13 MOV 18H,#73H ;Pr MOV 19H,#50H ;Pr JMP DIR2 DIR13: CJNE A,#5,DIR14 MOV 18H,#79H ;E JMP DIR2 DIR14: MOV A,18H XRL A,#03FH JNZ DIR3 MOV 18H,#00H DIR2: MOV A,19H XRL A,#03FH JNZ DIR3 MOV 19H,#00H MOV A,1AH JB ACC.7,DIR3 XRL A,#03FH JNZ DIR3 MOV 1AH,#00H DIR3: RET
RDIR: ADD A ,#1 MOVC A ,@A+PC RET DIR0: DB 3FH, 06H, 5BH, 4FH, 66H, 6DH, 7DH, 07H; DB 7FH, 6FH, 77H, 7CH, 39H, 5EH, 79H, 00H;
I2CW: NOP I2CW3: MOV A ,#0A0H ; MOV R5 ,#10H LCALL ICQ LCALL ICW MOV A ,R2 &nbs |