EasyManua.ls Logo

STC micro STC8A8K64D4 Series - Page 636

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
- 620 -
SDA BIT P1.4
SCL BIT P1.5
ISDA BIT 20H.0 ;Device address flag
ISMA BIT 20H.1 ;Storage address flag
ADDR DATA 21H
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 0100H
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
MOV P_SW2,#80H
MOV A,#10000001B ;Enable I2C slave mode
MOV DPTR,#I2CCFG
MOVX @DPTR,A
MOV A,#01011010B ;Set the slave device address to 5A
;/That is, I2CSLADR[7:1]=010_1101B, MA=0B.
;Since MA is 0, the device address sent by the host must be
; the same as I2CSLADR[7:1] to access this I2C slave device.
;If the host needs to write data, it will send 5AH(0101_1010B)
;If the host needs to read data, it will send 5BH (0101_1011B)
MOV DPTR,#I2CSLADR
MOVX @DPTR,A
MOV A,#00000000B
MOV DPTR,#I2CSLST
MOVX @DPTR,A
MOV A,#00000000B ;Disable interrupt of slave mode
MOV DPTR,#I2CSLCR

Table of Contents

Related product manuals