STC8A8K64D4 Series Manual
-
sfr P3M0 = 0xb2;
sfr P4M1 = 0xb3;
sfr P4M0 = 0xb4;
sfr P5M1 = 0xc9;
sfr P5M0 = 0xca;
sbit P10 = P1^0;
void LVD_Isr() interrupt 6
{
PCON &= ~LVDF; //Clear interrupt flag
P10 = !P10; //Test port
}
void main()
{
P0M0 = 0x00;
P0M1 = 0x00;
P1M0 = 0x00;
P1M1 = 0x00;
P2M0 = 0x00;
P2M1 = 0x00;
P3M0 = 0x00;
P3M1 = 0x00;
P4M0 = 0x00;
P4M1 = 0x00;
P5M0 = 0x00;
P5M1 = 0x00;
PCON &= ~LVDF; //Interrupt flag needs to be cleared at power-on
RSTCFG = LVD3V0; //Set the LVD voltage to 3.0V
ELVD = 1; //Enable LVD interrupt
EA = 1;
while (1);
}
Assembly code
;Operating frequency for test is 11.0592MHz
RSTCFG DATA 0FFH
ENLVR EQU 40H ;RSTCFG.6
LVD2V2 EQU 00H ;LVD@2.2V
LVD2V4 EQU 01H ;LVD@2.4V
LVD2V7 EQU 02H ;LVD@2.7V
LVD3V0 EQU 03H ;LVD@3.0V
ELVD BIT IE.6
LVDF EQU 20H ;PCON.5
P0M1 DATA 093H
P0M0 DATA 094H
P1M1 DATA 091H
P1M0 DATA 092H
P2M1 DATA 095H
P2M0 DATA 096H
P3M1 DATA 0B1H
P3M0 DATA 0B2H
P4M1 DATA 0B3H
P4M0 DATA 0B4H
P5M1 DATA 0C9H
P5M0 DATA 0CAH