Download 78K0/Kx2-L Sample Program (Serial Interface IICA)

Transcript
CHAPTER 4 SETTING METHODS
<2> Slave transmission
MMAIN_LOOP:
Start slave transmission.
...(Omitted)...
MOV
A,
[HL]
ADD
A,
#010H
MOV
IICA, A
LMAIN300:
HALT
(enter the HALT mode)
; Read the received data
; Create transmission data (received data + 10H)
; Start transmission
; Make the system wait until communication ends
End slave transmission.
...(Omitted)...
BT
CLR1
is not being
SET1
LMAIN310:
ACKD0, $LMAIN310
FMODE
communicated
WREL0
; Has an acknowledge signal been detected? Yes,
; The communication mode flag indicates that data
; Make the system exit the wait status
<3> Slave reception
MMAIN_LOOP:
Start slave reception.
...(Omitted)...
; Make the system exit the wait status
SET1
WREL0
LMAIN700:
HALT
(enter the HALT mode)
; Make the system wait until communication ends
Read the received data.
...(Omitted)...
MOV
MOV
CLR1
communicated
SET1
A,
IICA
[HL], A
FREADY
; Read the received data
; Save the received data
; The ready flag indicates that data cannot be
WREL0
; Make the system exit the wait status
1 byte is received.
26
Application Note U19691EJ1V0AN