Download Print this page

I 2 C Slave Mode (Polling Mode) - STC micro STC8A8K64D4 Series Reference Manual

Advertisement

STC8A8K64D4 Series Manual
CALL
MOV
CALL
CALL
MOV
CALL
CALL
MOV
CALL
CALL
MOV
CALL
CALL
MOV
CALL
CALL
CALL
LOOP:
CALL
MOV
CALL
CALL
MOV
CALL
CALL
CALL
MOV
CALL
CALL
CALL
MOV
CALL
CALL
MOV
CALL
CALL
MOV
CALL
CALL
CALL
JMP
END
2
21.5.4 I
C Slave Mode (Polling Mode)
C language code
//Operating frequency for test is 11.0592MHz
#include "reg51.h"
#include "intrins.h"
START
A,#0A2H
SENDDATA
RECVACK
A,#002H
SENDDATA
RECVACK
A,#00H
SENDDATA
RECVACK
A,#00H
SENDDATA
RECVACK
A,#12H
SENDDATA
RECVACK
STOP
START
A,#0A2H
SENDDATA
RECVACK
A,#002H
SENDDATA
RECVACK
START
A,#0A3H
SENDDATA
RECVACK
RECVDATA
P0,A
SENDACK
RECVDATA
P2,A
SENDACK
RECVDATA
P3,A
SENDNAK
STOP
DELAY
LOOP
;Send start command
;Send device address + write command
;Send storage address
;Set second value
;Set minute value
;Set hour value
;Send stop command
;Send start command
;Send device address + write command
;Send storage address
;Send start command
;Send device address + read command
;Read second value
;Read minute value
;Read hour value
;Send stop command
- 612 -

Advertisement

loading
Need help?

Need help?

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

This manual is also suitable for:

Micro stc8a8k64d4-64pinMicro stc8a8k64d4-48pin