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

no-image

I2C-Interface

Manufacturer Part Number
I2C-Interface
Description
Programming the 12C Interface
Manufacturer
Philips Semiconductors / NXP Semiconductors
Datasheet
THE STRUCTURE INITIAMATION
Ref
stream. The index IS the offset wtthin
code struct BR
case. The transmtt array can. if desired,
/*
sblt TransBlt = OxB3
formed as desired in the output btt
the transmit array. The mittaiizatton n-r
my case, for a sequence of 40 bits mak-
ing up four characters. was:
11
Philips Semiconductors
small model, this would have been the
default storage anyway.)
lows the serial bit to be selected from an
array of bytes called transmlt[4] in my
be set up to literally overlay all of the
internal memory, so that the maximum
&random access” can be achteved. This
was not necessary in my c3se.
IS defined:
E
internal RL41M. (Since
The physical port pm to be exercised
The
l*C Specific information
structure so that characters can be
index
3
'I b00000001 , I,
1
1
1
1
1
3
3
3
3
transmit 1s on
b00100000
b10000000
b10000000
b10000000
b01000000
b01000000
b00000010
b00000100
b00001000
b00010000
Index entry
ach
These are irntiaiized rn the Bit-
fined by an index and mask.
mask
bit to be transmrtted is de-
8itRef[41] =
I,
I,
1.
1.
1.
I,
1.
I,
I,
1.
in each structure al-
bump
P3 3 *I
/I 010
/'I 06
I/ 07
f/ 08
I/ 011
(1
/
I
I
'1 1 fixed
'/ 0 start bit
1 09
was using the
,
comnent
0 start bit
1 fixed
1 stop bit
guaranteed
order).
pp. 60-62.-Ed.]
The “bump” is a
flag that continues
the transmission.
When it finally
reaches 0, the
serial output
sequeflce will
stop.
tation 1s natural
references.)
the element of “transmit” in which the
bit restdes. Some mitializatton code has
transmlt[3] wtll be IO. so that they can
be referred to for start and stop bits and
for any tixed-vaiue bits that happen to
be m the data stream (in my case, the
fixed bits are used to indicate data byte
tion. [See “.A Binary Upgrade jbr C,
bler and hardware background. thts no-
(The *‘masks- are given in binary nota-
The *‘index” refers. as menttoned. to
3
3
3
,
b01000000 , 1.
b10000000 1.
b10000000 0
that the upper two bits of
Because
for me tn bit mask
/I 1 idle bit
79
I/ 0
/I 1
of my
stop bit
fixed
assem-
The pointer IS lncrcdsedin
tngon the
dicated earlier. this is aiwavs one except
in the last structure, so the serial trans-
mrsston always proceeds to the defined
end. The statement:
BR_ptr = &BitRef[40]
in lnitiaiization ~111
ter
BR_ptr = BitRef
IS
sequence.
BR_ptr-1index
transmit[index]
BR_ptr-)mask
TransBlt = bit
the transmtsston. When rt IS finally 0,
the serial output sequence ~111 stop.
THE CODE
(a) VansBit =
(b) if ( BR_ptr-)bump
The program
looks
(bit)(value 8 value)
T
BR_ptr++
-- to get byte with desired bit.
-- to get zero~nonzero value. which
-- 1s then cast to a bit for output
-- to port pin, the ultimate goal.
-- looks up current index, then used in
(bit)( transmit[ BLptr-1index
The *bump” IS a flag that continues
off
used
8
then ANDed with mask
BLptr-)mask
like this:
durmg
Bit-Banging
he code fragment that accom-
plishes the transmtssion IS:
to initiate
value
startup, and:
sequence
of
BR__Ptr-jbump. 2~s
)
keep the transmtt-
)
a transmtssron
for sectIon (a)
(b),depend-
Serial Ports
]
in-

Related parts for I2C-Interface