MAX187:
CLR P1.6
CLR P1.5
SETB P1.7
LOOP0:
MOV C,P1.7
JNC LOOP0
SETB P1.6
MOV R7,#04H
CLR A
LOOP1:
CLR P1.6
NOP
SETB P1.6
MOV C,P1.7
RLC A
DJNZ R7,LOOP1
MOV B,A
MOV R7,#08H
CLR A
LOOP2:
CLR P1.6
NOP
SETB P1.6
MOV C,P1.7
RLC A
DJNZ R7,LOOP2
SETB P1.5
MOV 20H,A
MOV 21H,B
RET