3886 Group User’s Manual
3-35
APPENDIX
3.3 Notes on use
3.3.6 Notes on multi-master I2C-BUS interface
(1)
Read-modify-write instruction
Precautions for read-modify-write instructions, such as SEB and CLB, when used for any of the
registers of the multi-master I2C-BUS interface, are described below.
I2C data shift register (S0: address 001216)
When executing the read-modify-write instruction for this register during transfer, data may become
an unexpected value.
I2C address register (S0D: address 001316)
When the read-modify-write instruction is executed for this register at detecting the STOP condition,
data may become an unexpected value.
s Reason
Because hardware changes the read/write bit (RWB) at detecting the STOP condition.
I2C status register (S1: address 001416)
Do not execute the read-modify-write instruction for this register because all bits of this register
are changed by hardware.
I2C control register (S1D: address 001516)
When the read-modify-write instruction is executed for this register at detecting the START condition
or at completing the byte transfer, data may become an unexpected value.
s Reason
Because hardware changes the bit counter (BC0 to BC2).
I2C clock control register (S2: address 001616)
The read-modify-write instruction can be executed for this register.
I2C START/STOP condition control register (S2D: address 001716)
The read-modify-write instruction can be executed for this register.
(2)
Procedure for generating START condition using multi-master
Procedure example (The necessary conditions for the procedure are described in Items to
below).
LDA #SLADR
(Take out slave address value)
SEI
(Disable interrupt)
BBS 5, S1, BUSBUSY (BB flag confirmation and branch process)
BUSFREE:
STA S0
(Write slave address value)
LDM #$F0, S1
(Trigger START condition generation)
CLI
(Enable interrupt)
:
BUSBUSY:
CLI
(Enable interrupt)
:
Use “Branch on Bit Set” of “BBS 5, S1, –” for the BB flag confirmation and branch process.
Use “STA”, “STX” or “STY” of the zero page addressing instruction for writing the slave address
value to the I2C data shift register (S0: address 001216).
Execute the branch instruction of above and the store instruction of above continuously shown
the above procedure example.
Disable interrupts during the following three process steps:
BB flag confirmation
Write slave address value
Trigger START condition generation
When the BB flag is in bus busy state, enable interrupts immediately.