I 2 C Bus ControllerI 2 C Interface Setup ExamplesPanasonic Semiconductor Development Company MN102H75K/F75K/85K/F85K LSI User Manual300Panasonic13.6 I 2 C Interface Setup Examples13.6.1 Setting Up a Transition from Master Transmitter to Mas-ter ReceiverThis example demonstrates how to set up a data transfer when changing frommaster transmitter to master receiver. Figure 13-7 shows an example waveform.13.6.1.1 Pre-configuringn To set up the I/O port:Set port control register 0 (PCNT0; x’00FF90’) to x’0100’ (enabling the SDA0and SCL0 pins) and set the port 6 output mode register (P6MD; x’00FFFC’) tox’0003’ (selecting the SDA0 and SCL0 functions).n To enable I 2 C interrupts:Set the I 2C interrupt control register pair (I2C0ICH and I2C0ICL; x’00FC9C’) tox’0100’.n To set up the I 2C registers:1. Set the I2CCLK register (x’007E46’) to x’0041’, selecting a clock frequencyof 80 kHz.2. Set the I2CDTRM register (x'007E40') to x'05FD'. This sets STA to 1, STPto 0, and ACK to 0. Bits 7 to 1 of the transmission data setting (x'FD') indi-cate the address (b'1111110') of the slave device from which the microcon-troller will request the data, and bit 0 indicates the read/write setting (bit 0 =1 = read).13.6.1.2 Setting Up the First InterruptWhen an ACK = 0 signal returns from the slave device, the I 2 C bus controllergenerates an interrupt. At this point, implement the following settings:n To set up the interrupt:Set the I2C0ICH and I2C0ICL register pair (x’00FC9C’) to x’0100’. Thisenables I 2 C interrupts and clears the previous interrupt request.n To set up the I 2C registers:1. Read the I2CDREC register (x’007E42’) to determine the I2 C bus controllerstatus.2. Since the microcontroller will become a receiver on the next operation, setthe I2CDTRM register (x’007E40’) to x’0000’. This sets STA, STP, ACK,and the transmission data to 0s. With this setting, the microcontroller returnsan ACK = 0 signal on the ninth clock.