EasyManua.ls Logo

STC micro STC8A8K64D4 Series - Page 591

Default Icon
901 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
STC8A8K64D4 Series Manual
- 575 -
{
SPSTAT = 0xc0; //Clear interrupt flag
SPDAT = SPDAT; //Transmit the received data back to the master
LED = !LED; //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;
SPCTL = 0x40; //Enable SPI slave mode
SPSTAT = 0xc0; //Clear interrupt flag
IE2 = ESPI; //Enable SPI interrupt
EA = 1;
while (1);
}
Assembly code
;Operating frequency for test is 11.0592MHz
SPSTAT DATA 0CDH
SPCTL DATA 0CEH
SPDAT DATA 0CFH
IE2 DATA 0AFH
ESPI EQU 02H
LED BIT P1.1
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
ORG 0000H
LJMP MAIN
ORG 004BH
LJMP SPIISR

Table of Contents

Related product manuals