ORG 0000H
LJMP BEGIN
ORG 0003H
LJMP WINT0
ORG 000BH
LJMP COUNTERO
ORG 0013H
LJMP WINT1
ORG 001BH
LJMP TIMER1
ORG 0030H
BEGIN: CLR IT0
CLR IT1
MOV TMOD,#16H
MOV TL1,#0B0H
MOV TH1,#3CH
MOV TL0,#9CH
MOV TH0,#9CH
SETB TR1
SETB TR0
SETB EA
SETB ET0
SETB ET1
SETB EX0
SETB EX1
SETB PX0
FLAG BIT 00H
CLR FLAG
;水滴形点亮方案
WATER: JBC FLAG,FLASH
MOV 00H,#08H
MOV R2,#00000000B
START: MOV R1,00H
MOV A,#10000000B
LOOP: MOV R3,A
ORL A,R2
CPL A
MOV P1,A
LCALL DELAY
MOV A,R3
RR A
DJNZ R1,LOOP
SETB PSW.7
MOV A,R2
RLC A
MOV R2,A
DJNZ 00H,START
MOV P1,#0FFH
LCALL DELAY
SJMP WATER
;拉幕型点亮方案
FLASH: JBC FLAG,FLASH
MOV R1,#00H
MOV DPTR,#TABLE
LOOP1: MOV A,R1
MOVC A,@A+DPTR
CPL A
MOV P1,A
LCALL DELAY
INC R1
CJNE R1,#08H,LOOP1
SJMP FLASH
DELAY: MOV R4,#64H
LP1: MOV R5,#64H
LP2: NOP
NOP
NOP
NOP
DJNZ R5,LP2
DJNZ R4,LP1
RET
LONG_DELAY: MOV R4,#0F0H
LP3: MOV R5,#0A8H
LP4: NOP
NOP
NOP
NOP
DJNZ R5,LP4
DJNZ R4,LP3
RET
SHORT_DELAY: MOV R4,#30H
LP5: MOV R5,#80H
LP6: NOP
NOP
NOP
NOP
DJNZ R5,LP6
DJNZ R4,LP5
RET
COUNTERO: SETB FLAG
RETI
TIMER1: SETB P3.4
CLR P3.4
MOV TL1,#0B0H
MOV TH1,#3CH
RETI
WINT1: MOV A,#10101010B
MOV P1,A
LCALL DELAY500ms
MOV P1,#0FFH
LCALL DELAY500ms
SJMP WINT1
WINT0: MOV A,#01010101B
MOV P1,A
LCALL DELAY50ms
MOV P1,#0FFH
LCALL DELAY50ms
SJMP WINT0
DELAY500ms: MOV 3FH,#05H
LP7: JNB TF1,$
CLR TF1
DJNZ 3FH,LP7
RET
DELAY50ms: MOV TH1,#9EH
MOV TL1,#58H
JNB TF1,$
CLR TF1
RET
TABLE:DB 81H,0C3H,0E7H,0FFH,0E7H,0C3H,81H,00H ;拉幕型点亮的显示码
END