STC8A8K64D4 Series Manual
-
ORG 0000H
LJMP MAIN
ORG 0033H
LJMP LVDISR
ORG 0100H
LVDISR:
ANL PCON,#NOT LVDF ;Clear interrupt flag
CPL P1.0 ;Test port
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
ANL PCON,#NOT LVDF ;Interrupt flag needs to be cleared at power-on
MOV RSTCFG,# LVD3V0 ;Set the LVD voltage to 3.0V
SETB ELVD ;Enable LVD interrupt
SETB EA
JMP $
END
11.5.18 SPI Interrupt
C language code
//Operating frequency for test is 11.0592MHz
#include "reg51.h"
#include "intrins.h"
sfr SPSTAT = 0xcd;
sfr SPCTL = 0xce;
sfr SPDAT = 0xcf;
sfr IE2 = 0xaf;
#define ESPI 0x02
sfr P0M1 = 0x93;
sfr P0M0 = 0x94;
sfr P1M1 = 0x91;
sfr P1M0 = 0x92;
sfr P2M1 = 0x95;
sfr P2M0 = 0x96;
sfr P3M1 = 0xb1;
sfr P3M0 = 0xb2;
sfr P4M1 = 0xb3;
sfr P4M0 = 0xb4;