ORG 0000H START:MOV SP,#60H JMP MAIN ORG 0023H PUSH A PUSH PSW PUSH B CLR RI MOV A,SBUF D100US:PUSH 02H MOV R2,#150 EEE1:DJNZ R2,EEE1 POP 02H RET D1MS:MOV R3,#2 ;延时子程序 JMP LOOP92 D10MS:MOV R3,#20 ;延时子程序 LOOP92:MOV R2,#0FAH LOOP91:DJNZ R2,LOOP91 DJNZ R3,LOOP92 RET D60MS:MOV R3,#120 ;延时子程序 LOOP94:MOV R2,#0FAH LOOP93:DJNZ R2,LOOP93 DJNZ R3,LOOP94 RET EEPWR:PUSH PSW PUSH A SETB PSW.3 CALL ESTR CLR C MOV A,DZJCQH RLC A ORL A,#0A0H CALL WROM MOV A,DZJCQL CALL WROM MOV A,SJJCQ CALL WROM CALL ESTOP NOP MOV R7,#10 DJNZ R7,$ POP A POP PSW RET EEPRD:PUSH PSW PUSH A SETB PSW.3 CALL ESTR CLR C MOV A,DZJCQH RLC A ORL A,#0A0H CALL WROM MOV A,DZJCQL CALL WROM CALL ESTR MOV A,#0A1H CALL WROM CALL RROM MOV SJJCQ,A CALL ESTOP MOV R7,#10 DJNZ R7,$ POP A POP PSW RET ESTR:MOV R7,#2 NOP DJNZ R7,$ CLR SCL MOV R7,#2 NOP DJNZ R7,$ SETB SDA MOV R7,#2 NOP DJNZ R7,$ NOP ;1.5US SETB SCL MOV R7,#2 NOP DJNZ R7,$ NOP ;6.5US NOP NOP CLR SDA MOV R7,#2 NOP DJNZ R7,$ NOP ;5US NOP NOP CLR SCL MOV R7,#8 ;20US NOP DJNZ R7,$ RET WROM:MOV R1,#8 WROM0:RLC A MOV SDA,C MOV R7,#2 NOP DJNZ R7,$ NOP SETB SCL MOV R7,#2 NOP DJNZ R7,$ NOP NOP NOP CLR SCL MOV R7,#8 NOP DJNZ R7,$ DJNZ R1,WROM0 SETB SDA MOV R7,#2 NOP DJNZ R7,$ NOP SETB SCL MOV R7,#2 NOP DJNZ R7,$ NOP MOV C,SDA MOV R7,#8 NOP DJNZ R7,$ CLR SCL MOV R7,#8 NOP DJNZ R7,$ RET ESTOP:CLR SDA MOV R7,#2 NOP DJNZ R7,$ NOP NOP NOP SETB SCL NOP NOP SETB SDA NOP NOP NOP CLR SCL RET RROM:MOV R2,#8 NOP CLR SCL SETB SDA RROM1:MOV R7,#2 NOP DJNZ R7,$ SETB SCL NOP MOV C,SDA RLC A MOV R7,#1 NOP DJNZ R7,$ CLR SCL DJNZ R2,RROM1 MOV R7,#5 NOP DJNZ R7,$ RET DISPLAY:MOV DPTR,#TABLE1 ;显示子程序 MOV A,XHSZ+3 MOVC A,@A+DPTR CALL CLSX MOV A,XHSZ+2 MOVC A,@A+DPTR CALL CLSX MOV A,XHSZ+1 MOVC A,@A+DPTR CALL CLSX MOV A,XHSZ MOVC A,@A+DPTR CALL CLSX SETB OE SETB ST NOP NOP CLR ST CLR OE RET QXS:MOV R4,#4 DISP4:MOV A,#04H CPL A CALL CLSX DJNZ R4,DISP4 SETB OE SETB ST NOP NOP CLR ST CLR OE RET CLSX:MOV R5,#8 CLSX1:RRC A MOV DOT,C SETB CP NOP NOP CLR CP DJNZ R5,CLSX1 RET TABLE1:DB 44H,0DEH,26H,16H ;"0--3" DB 9CH,15H,05H,5EH ;"4--7" DB 04H,14H,0CH,85H ;"8,9,A,B" DB 65H,86H,25H,2DH ;"C,D,E,F" DB 0FBH,0BFH,2CH,0E5H ;" ,-,P,L" DB 6DH,0C4H,4CH,0FFH ;"Γ,U,N" ; TABLE1:DB 0BFH,86H,0DBH,0CFH,0E6H,0EDH,0FDH,87H ;0. - 7. DB 0FFH,0EFH,88H,0,0,0,0,0 ;8. - 9. DB 28H,0faH,49H,58H ;"0--3" DB 9aH,1cH,0cH,0f8H ;"4--7" DB 08H,18H,0FFH,0DFH ;"8,9, ,-" DB 89H,7FH,0DH,8DH ;"P,_,E,F" DB 20H,0F2H,41H,50H ;"0.--3." DB 92H,14H,04H,0F0H ;"4.--7." DB 00H,10H,0F7H,0D7H ;"8.,9., ., ." DB 81H,77H,05H,85H ;"P.,_.,E.,F." RET END |