Download Print this page

STC micro STC8A8K64D4 Series Reference Manual page 598

Advertisement

STC8A8K64D4 Series Manual
SPCTL = 0x40;
SPSTAT = 0xc0;
IE2 = ESPI;
EA = 1;
while (1)
{
if (!KEY)
{
SPCTL = 0x50;
SS = 0;
SPDAT = 0x5a;
while (!KEY);
}
}
}
Assembly code
;Operating frequency for test is 11.0592MHz
SPSTAT
DATA
SPCTL
DATA
SPDAT
DATA
IE2
DATA
ESPI
EQU
SS
BIT
LED
BIT
KEY
BIT
P0M1
DATA
P0M0
DATA
P1M1
DATA
P1M0
DATA
P2M1
DATA
P2M0
DATA
P3M1
DATA
P3M0
DATA
P4M1
DATA
P4M0
DATA
P5M1
DATA
P5M0
DATA
ORG
LJMP
ORG
LJMP
ORG
SPIISR:
PUSH
MOV
MOV
JB
SLAVE:
MOV
0CDH
0CEH
0CFH
0AFH
02H
P1.0
P1.1
P0.0
093H
094H
091H
092H
095H
096H
0B1H
0B2H
0B3H
0B4H
0C9H
0CAH
0000H
MAIN
004BH
SPIISR
0100H
ACC
SPSTAT,#0C0H
A,SPCTL
ACC.4,MASTER
SPDAT,SPDAT
//Enable SPI slave modeand standby
//Clear interrupt flag
//Enable SPI interrupt
//Wait for the key to trigger
//Enable SPI master mode
//Pull down the slave SS pin
//Send test data
//Wait for the keys to be released
;Clear interrupt flag
;Transmit the received data back to the master
- 582 -

Advertisement

loading
Need help?

Need help?

Do you have a question about the micro STC8A8K64D4 Series and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Micro stc8a8k64d4-64pinMicro stc8a8k64d4-48pin