STC8A8K64D4 Series Manual
-
ORG 0100H
I2CISR:
PUSH ACC
PUSH DPH
PUSH DPL
ORL PSW2,#80H
MOV DPTR,#I2CSLST
MOVX A,@DPTR
ANL A,#NOT 40H
MOVX @DPTR,A
POP DPL
POP DPH
POP ACC
RETI
MAIN:
MOV SP, #5FH
MOV P0M0, #00H
MOV P0M1, #00H
MOV P1M0, #00H
MOV P1M1, #00H
MOV P2M0, #00H
MOV P2M1, #00H
MOV P3M0, #00H
MOV P3M1, #00H
MOV P4M0, #00H
MOV P4M1, #00H
MOV P5M0, #00H
MOV P5M1, #00H
MOV P_SW2,#00H ;Wake up MCU on the falling edge of SDA/P1.4
// MOV P_SW2,#10H ;Wake up MCU on the falling edge of SDA_2/P2.4
// MOV P_SW2,#30H ;Wake up MCU on the falling edge of SDA_4/P3.3
ORL P_SW2,#80H
MOV DPTR,#I2CCFG
MOV A,#80H
MOVX @DPTR,A ;Enable slave mode of I2C module
MOV DPTR,# I2CSLCR
MOV A,#40H ;Enable start signal interrupt
SETB EA
MOV PCON,#02H ;MCU enters power down mode
NOP ;It will not enter the interrupt service routine after wake-up from power down mode.
NOP
NOP
NOP
LOOP:
CPL P1.1
JMP LOOP
END
6.7.11 Wake up MCU from Power Saving Mode using Power-down wake-up
timer
C language code