Setting Up I 2 C Transmission Using Serial Interface 0 - Panasonic MN10285K User Manual

Panax series microcomputer
Table of Contents

Advertisement

Serial Interfaces
Serial Interface Setup Examples
2
I
C mode requires open-drain
pins. To set this up, set the
ODASCI0 bit of PCNT0
(x'00FF90') to 1. In addition, set
the P5PUP7 and P5PUP5 bits of
P5PUP (x'00FFB5') to enable
pullup control of the SBO0 and
STB0.
The parity bits serve as the ACK
signal. To output an ACK = 1 sig-
nal, select a fixed parity of 1. To
output an ACK = 0 signal, select
a fixed parity of 0. Select a parity
of none if there is no ACK signal.
Reception must be enabled for
the circuit to detect a start
sequence.
MN102H75K/F75K/85K/F85K LSI User Manual
5.6.4
Setting Up I
This example illustrates the microcontroller as a master transmitter in the I
mode, using the SBO0 and SBT0 pins.
To set up the output ports:
Set the P5MD7 and P5MD5 bits of the port 5 output mode register (P5MD) to 1.
This selects the SBO0 and SBT0 pins as the output port for the I
P5MD (example)
Bit:
7
6
5
4
P5
P5
P5
P5
MD7
MD6
MD5
MD4
Setting:
1
0
1
0
2
To set up the I
C interface:
Set the operating conditions in the serial control register (SC0CTR). Select ACK
= 1 output for the transfer clock (SC0PTY[2:0] = b'101'), 8-bit character length
2
(SCLN = 1), I
C protocol (SC0PTL = 1), I
first bit order (SC0OD = 1). Enable both transmission and reception (SC0TEN
and SC0REN = 1) and disable transmission breaks (SC0BRE = 0). Select the
timer 0 underflow rate divided by 8 as the clock source.
SC0CTR (example)
Bit:
15
14
13
12
SC0
SC0
SC0
SC0
SC0
TEN
REN
BRE
I2CS
PTL
Setting:
1
1
0
0
To set up the start sequence:
Write a 1 to the SC0IIC bit of the SC0CTR register to signal the start sequence.
The SBO0 pin output immediately goes low. Read SC0STR to verify that the
start sequence occurred correctly (SC0IST = 1). At this point, even if another
start exists on the bus, an arbitration lost will not be detected.
To transmit the first data byte:
1.
Load the data to the serial port 0 transmit/receive buffer, which initiates data
output. The SBO0 pin begins data output to the I
clock signal goes low, with a 1/8 clock cycle delay.
2.
After transmission, both the SBO0 and SBT0 signals stay low.
To transmit a second data byte:
Load the data to the serial port 0 transmit/receive buffer. The sequence for the
first data byte repeats.
To set up the stop sequence:
1.
When all the data has been transmitted, set the SC0IIC bit of SC0CTR to 0.
Never perform this step during transmission.
137
Panasonic
2
C Transmission Using Serial Interface 0
3
2
1
0
P5
P5
P5
P5
MD3
MD2
MD1
MD0
0
0
0
0
2
C mode (SC0ICM = 1), and MSB-
11
10
9
8
7
6
SC0
SC0
SC0
SC0
OD
I2CM
LN
PTY2
1
0
1
1
1
1
Panasonic Semiconductor Development Company
2
C
2
C interface.
x'00FFFA'
x'00FD80'
5
4
3
2
1
SC0
SC0
SC0
SC0
SC0
PTY1
PTY0
SB
S1
S0
0
1
0
0
0
2
C bus when the SBT0
0
1

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mn102f75kMn102f85kMn102h75kMn102h85k

Table of Contents