; AT<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />89C2051宾馆客房电器综合控制源程序
org 50h
ajmp main
main: mov p3, #0ffh;
RKA: JB P3.7, RKA;
ACALL YSMS;
JNB P3.7, CKA;
LJMP RKA;
NOP
NOP
LJMP RKA;
RKB: JNB P3.7, RK0;
ACALL YSMS;
JB P3.7, CKB;
RK0: JB P3.0, RK1;
ACALL YSMS;
JNB P3.0, CK0 ;
RK1: JB P3.1, RK2;
ACALL YSMS;
JNB P3.1, CK1 ;
RK2: JB P3.2, RK3;
ACALL YSMS;
JNB P3.2, CK2 ;
RK3: JB P3.3, RK4;
ACALL YSMS;
JNB P3.3, CK3 ;
RK4: JB P3.4, RK5;
ACALL YSMS;
JNB P3.4, CK4 ;
RK5: JB P3.5, RKB;
ACALL YSMS;
JNB P3.5, CK5 ;
LJMP RKB;
NOP
NOP
LJMP RKB;
;---------------------------------
CKA: CLR P1.0;
CLR P1.1;
LJMP RKB;
NOP
NOP
LJMP RKB;
CKB: ACALL YS15S;
MOV P1, #0ffh;
LJMP RKA;
NOP
NOP
LJMP RKA;
CK0: CPL P1.0;
LJMP RK1;
NOP
NOP
LJMP RK1;
CK1: CPL P1.1;
LJMP RK2;
NOP
NOP
LJMP RK2;
CK2: CPL P1.2;
LJMP RK3;
NOP
NOP
LJMP RK3;
CK3: CPL P1.3;
LJMP RK4;
NOP
NOP
LJMP RK4;
CK4: CPL P1.4;
LJMP RK5;
NOP
NOP
LJMP RK5;
CK5: CPL P1.5;
LJMP RKB;
NOP
NOP
LJMP RKB;
;------------------------------------
YS15S: MOV R7, #0FAH;
YS1: MOV R6, #0FAH;
YS2: MOV R5, #20H; 15S
YS3: DJNZ R5, YS3;
DJNZ R6, YS2;
DJNZ R7, YS1;
RET;
;-------------------------------------
YSms: MOV R4, #0FFH;
YS4: MOV R3, #3FH;
YS5: DJNZ R3, YS5;
DJNZ R4, YS4;
RET;
;-------------------------------------
END;
用户377235 2013-4-15 09:58