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

no-image

I2C-Interface

Manufacturer Part Number
I2C-Interface
Description
Programming the 12C Interface
Manufacturer
Philips Semiconductors / NXP Semiconductors
Datasheet
only, but I have used a stmtlar procedure
There is no transmtt state-machine,
spectai provtston for start and stop bits.
2nd it takes less than two dozen ma-
chine cycles for each bit. It has a further
Advantage that the data doesn’t need to
That 1s. the bits that are adjacent m the
transmit
adjacent when they are stored m mem-
ory. This soiutton IS for a transmttter
for receiving.
and hence IS desirable in many applica-
priately
The practice is affecttonateiy
tibu-bangmg.”
the advantages of being simple and fast.
be specrafly orgamzed for transmtttmg.
Philips Semiconductors
cheaper
working with low-cost mtcrocontrollers.
ded developers must cultivate. An op-
came m the form of a project using the
Signettcs
8x75
internal serial port-no
SBUF shift registers to RxD and TxD.
no diverston of timers to baud rate pac-
mg, no serial interrupts.
low-prtced and offers a small-fcotprmt,
ttons. Where the price or size outweighs
the need for a simple sertai port, one
must be butlt out of firmware by appro-
do you accomplish
project than your boss or customer asks
you to do it agam,
there’s
things cheaper through magtc software.
ware trickery IS a skill that a11 embed-
portumty for me to practice such tricks
T
Serial Posts
Bit-Banging
The approach
l*C Specific information
Performmg
1
is an 805
controlling a single bit m a port.
still that
this time. Even when you’re
data stream don’t need to be
8x75
the mother of inventron.
and it certainly seems to
be the case in embedded
systems work. No sooner
hey say that necesstty IS
I
mrracies through
1
dertvattve that has no
I’ll describe here has
mtcrocontroller.
the tmposstble in one
mcenttve
only faster and
But the chip is
attachment
known as
to make
soft-
The
no
of
THE STRUCTURE POINTER SOLUTION
signing code to provtde a sertai data out-
such a scheme.
dnd to sequence through the set of bytes
acttvtties as well as a sertal port (such as
verter. performing averages. and so on ),
so it was imperative that the sertal port
time ioop (to avotd interrupt overhead),
rt was dfso a godi that the code take a
fixed amount of time regardless
current transmrt state.
put-the
however. special states and a counter are
needed to provide the start and stop bits
provide a serial
dt 9600 baud. This rate gives a per-bit
time of 104 mtcroseconds.
if you’re using a 12-AMHz part. The ap-
plication in question had plenty of other
reading a serial analog-to-digital
handling take an absolute munmum of
ttme. Since I chose to execute in a tixed-
G
The shift (or
rotate) operation
that comes to
mind when you’re
designing code to
data output.
is the first thing
My
project was required to operate
enerally, the shift (or rotate)
operation is the first thing that
comes to mind when you’re de-
format of the data suggests
With this approach.
77
or IO4 cycles
of the
con-
sequence bit by bit and uses a pointer to
this array as the only controlling
scarce internal RAM is used.
to be transmitted.
an array of structures
PROM space) that defines the transmit
merit. This means that only two bytes of
The method presented here provides
Bit-Banging Serial Ports
(in the cede or
eie-

Related parts for I2C-Interface