EasyManua.ls Logo

STC micro STC8A8K64D4 Series - Page 616

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
- 600 -
MOV R0,#0
MOV R1,#0
DELAY1:
NOP
NOP
NOP
NOP
DJNZ R1,DELAY1
DJNZ R0,DELAY1
RET
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,#11100000B ;Set the I2C module as master mode
MOV DPTR,#I2CCFG
MOVX @DPTR,A
MOV A,#00000000B
MOV DPTR,#I2CMSST
MOVX @DPTR,A
SETB EA
CALL START ;Send start command
MOV A,#0A0H
CALL SENDDATA ;Send device address + write command
CALL RECVACK
MOV A,#000H ;Send storage address high byte
CALL SENDDATA
CALL RECVACK
MOV A,#000H ;Send storage address low byte
CALL SENDDATA
CALL RECVACK
MOV A,#12H ;Write test data 1
CALL SENDDATA
CALL RECVACK
MOV A,#78H ;Write test data 2
CALL SENDDATA
CALL RECVACK
CALL STOP ;Send stop command
CALL DELAY ;Waiting for the device to write data
CALL START ;Send start command
MOV A,#0A0H ;Send device address + write command

Table of Contents

Related product manuals