STC8A8K64D4 Series Manual
-
P0M0 = 0x00;
P0M1 = 0x00;
P1M0 = 0x00;
P1M1 = 0x00;
P2M0 = 0x00;
P2M1 = 0x00;
P3M0 = 0x00;
P3M1 = 0x00;
P4M0 = 0x00;
P4M1 = 0x00;
P5M0 = 0x00;
P5M1 = 0x00;
P_SW1 = 0x00; //Wake up MCU on the falling edge of RXD / P3.0
// P_SW1 = 0x40; //Wake up MCU on the falling edge of RXD_2/P3.6
// P_SW1 = 0x80; //Wake up MCU on the falling edge of RXD_3/P1.6
// P_SW1 = 0xc0; //Wake up MCU on the falling edge of RXD_4/P4.3
P_SW2 = 0x00; //Wake up MCU on the falling edge of RXD2/P1.0
// P_SW2 = 0x01; //Wake up MCU on the falling edge of RXD2_2/P4.6
P_SW2 = 0x00; //Wake up MCU on the falling edge of RXD3/P0.0
// P_SW2 = 0x02; //Wake up MCU on the falling edge of RXD3_2/P5.0
P_SW2 = 0x00; //Wake up MCU on the falling edge of RXD4/P0.2
// P_SW2 = 0x04; //Wake up MCU on the falling edge of RXD4_2/P5.2
ES = 1; //Enable UART interrupt
IE2 = ES2; //Enable UART2 interrupt
IE2 |= ES3; //Enable UART3 interrupt
IE2| = ES4; //Enable UART4 interrupt
EA = 1;
PCON = 0x02; //MCU enters power-down mode
_nop_(); //It will not enter the interrupt service routine after wake-up from power-down mode.
_nop_();
_nop_();
_nop_();
while (1)
{
P11 = ~P11;
}
}
Assembly code
; Operating frequency for test is 11.0592MHz
IE2 DATA 0AFH
ES2 EQU 01H
ES3 EQU 08H
ES4 EQU 10H
P_SW1 DATA 0A2H
P_SW2 DATA 0BAH
P0M1 DATA 093H
P0M0 DATA 094H
P1M1 DATA 091H
P1M0 DATA 092H