I2C-Interface Philips Semiconductors / NXP Semiconductors, I2C-Interface Datasheet - Page 4

no-image

I2C-Interface

Manufacturer Part Number
I2C-Interface
Description
Programming the 12C Interface
Manufacturer
Philips Semiconductors / NXP Semiconductors
Datasheet
Philips Semiconductors
Figure 3: Flowchar? Jor IX
procedure
pasxci
cetve procedure.
pammeter5--slave
sage count-xe
~0
length
c3use of 5egmentation
mg, bus-a~~aMxi~tv
condltlon
receive
from the tran5mlt code
dure differs 5hghtly once the start con
j The ma5ter broxica5ts
+ The master recene5
5 The ma5ter generace
The structure
.I far pointer to the receive butfer
12C Specific information
non
dress md aspects
.iddre55ed slave
ot dam and \ends <m XK
Jtter each Me.
the bdst bake bv not 5endmg an ,\Ch
non &md reiea5e5 the bus
procedures
No ACK
on
15
on the stack to the ma5ter rc
procedure
fiixed At
the bu5
generJtlon
I
Byte = l*C
93
The received me55ag
of the receive
stop
Start
ldentlcai between
The remainder
6+
The ma5ter signal
xe
address,
addres5
>ensmg, Jnd \tan
Kbvtes. +qun bt
XI ‘\CK from th
Send ACK
The error-chech
Byte ++
0 or more bvte
sectIons
N=l
lifted verbxlr
J \cop cond
the 5iave ad-
1
to the >lav
receufe
and me>
proce
ot th
ot th
th
I
b.
I-
51
I
only when the clock 15 driven
on a wide armv ot 1% device5 mngmg
slzer5. .So compatlbllitv
heen seen to date.
Enhancing the Code
hxxxng
decrements
an XK
Using the Procedures
Ll5tmg Three (page
progrxn
rnlt and tnaster receive procedure5
cxil to procedure
lvord
en-segment
%A1064
The
fYFS%3
procedure
di5abled
procedures.
oppomme
In control of the clock) could cause the
bus to hxq
terrupts
trom senat EEPROMs to
l’w
dure5
the receive loop once the 5lave dcknow-
&er that of the trdnsmlt procedure.
SCL line and the 5hlhq
ta otf the SDA lme Into the CPU Eight
LteKlhons ot the mer
ro receive
>tores the received
IS sqgaited
&Ion
3 The 5b~ve -1ddresa IS tran5mltted
mg one iteration ot the rran5mlt proce-
ledges Its addre5s
Inner loop controls the Ltockmg of the
These procedure5
The receive Imp 5tructure 15 patterned
Please note that Interrupts
into distinct macros
kIcked around
compatimentalized
(watching, waiting,
and doin& can be
time
building block oj*
‘WS-” on a four-character.
hss heen generated.
outer loop
the 12Cprotocol
perIodically,
the 1% procedures.
to the slave. The la5t data byte
that u5e5 both the ma5ter trxx-
durtng the execution
1% compatible
real-time clock by the cait to
All the basic
time
IX_RECV
each bvte
of dav
by not 5endq
the byte count, then sencL>
dl5piav controlled
.&n mterruptlon
It you need to service m-
c
when the ma5ter IS not
IX_XMT
Control 15 pa\5ed to
many &25
IS read
bate II-I the buffer.
110) \hows J short
loop are performed
then enable them
have heen rested
The outer
problems
ot rhe 5txxdl do-
dispiav driver.
vow
72
an ACK
dlspiavs tie
‘t’ou
5ee Fqglre
tram
at an m-
must be
low.
ot both
svnthe-
for en-
bv the
could.
have
loop
5ev-
The
The
the
u5-
Programming the 12C Interface
Philips Semiconductors
\vlth umed uxemipt5
could perform
pxi5es
es could
time
throughput.
order of magnitude
of the code, but n,ould be worth It for
high-pertormance.
Conclusion
1%
In comes to serial protocols.
some ot the technques
wil
other ,xmuiated”
JS those targeted
tlon market. Who knows, maybe some-
dav J snippet
way Into a trulv Intelligent dishwasher.
I’ll be waltmg
References
Z2C Bus SpeczJic~~twz. PhIlips Corpora-
tion
for example,
hgh-level
The u5e of tImed mtemlpts
Reprinted with permission of Dr.
unless
IS
carry over Into the development
c
undated)
not the onlv game m town when
kernel,
Entwe
.&iong the 5ame ime5. the paus-
Dobbk Journal, 1992
otnelwlae
be scheduled
language
by M6T Pubitsh#ng,
ccmfeflts
All rights
Flnaltv, vou could
a
replxx
SurtnVvale,
of mv code mdv find 1t.5
North
agam
useful work durmg the
notao o” 3peclflC artIclea.
senai protocols,
at the home-automd-
copyright
real-time 5ystems.
resected.
American
calling 5tructure.
to the complextv
That wry, the CPL’
the tmimg loop5
improvIng
presented
Callfornta
811 E. Arquas
IX
using
* 1992
PhIlIps
HopeMy,
Jdd5 an
P 0. Box 3409
a real-
94088-3409
add a
such
Company
CPti
here
Avenue
of

Related parts for I2C-Interface