Setting Up A Transition From Slave Receiver To Slave Transmitter; Pre-Configuring; Setting Up The First Interrupt; Panasonic - Panasonic MN10285K User Manual

Panax series microcomputer
Table of Contents

Advertisement

Panasonic Semiconductor Development Company
13.6.2 Setting Up a Transition from Slave Receiver to Slave
Transmitter
This example demonstrates how to set up a data transfer when changing from
slave receiver to slave transmitter. Figure 13-8 shows an example waveform.

13.6.2.1 Pre-configuring

To set up the I/O port:
Set port control register 0 (PCNT0; x'00FF90') to x'0300' (enabling the SDA1
and SCL1 pins) and set the port 0 output mode register (P0MD; x'00FFF0') to
x'0006' (selecting the SDA1 and SCL1 functions).
2
To enable I
C interrupts:
2
Set the I
C interrupt control register pair (I2C0ICH and I2C0ICL; x'00FC9C') to
x'0100'.
2
To set up the I
C registers:
1.
Set the I2CMYAD register (x'007E44') to x'0024'. This sets the slave
address of the microcontroller.
2.
Set the I2CDTRM register (x'007E40') to x'0000'. This sets STA, STP,
ACK, and the transmission data to 0s. With this setting, the microcontroller
returns an ACK = 0 signal when an address match occurs. The master sends
data (the slave address) to the slave microcontroller in sync with the master
clock. When the R/W bit = 1, the microcontroller changes from a slave
receiver to a slave transmitter.

13.6.2.2 Setting Up the First Interrupt

Once the microcontroller becomes a slave transmitter, set up the transmission
data.
To set up the interrupt:
Set the I2C0ICH and I2C0ICL register pair (x'00FC9C') to x'0100'. This
2
enables I
C interrupts and clears the previous interrupt request.
2
To set up the I
C registers:
1.
Read the I2CDREC register (x'007E42') to determine the I
status. AAS should be 1.
2.
Set the I2CDTRM register (x'007E40') to x'0155'. This sets STA to 0, STP
to 0, ACK to 1, and the transmission data to x'55'. The microcontroller does
not need to issue an ACK signal in this transfer, so the ACK bit should be 1.
3.
Begin transmitting data in sync with the clock from the master.
302

Panasonic

2
I
C Interface Setup Examples
MN102H75K/F75K/85K/F85K LSI User Manual
2
I
C Bus Controller
2
C bus controller

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mn102f75kMn102f85kMn102h75kMn102h85k

Table of Contents