Searching \ for 'I2C with AN554 code' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page:
Search entire site for: 'I2C with AN554 code'.

Truncated match.
PICList Thread
'I2C with AN554 code'
1998\02\04@061710 by Steen Jensen

Hello All

I am trying to software implement a I2C Master in my 16C62. I have included
some code from AN554 ( and i2c.h) in my main program. This
should make me able to call various macro«s and subroutine«s which handle
all the I2C stuff. I have followed the test examples from Microchip, but my
program does not work out the way I want it to. Does any of you have a
program where you use the AN554 code or some other I2C mester software ? I
you have, I would like to take a look at it. I am stucked so I am desperate
for some new inspiration

With kind regards
GDK-SSJ - Steen Schelle Jensen
Dept.: 1545
Internet e-mail:

1998\02\04@072844 by Keith Howell

Steen Jensen wrote:
> I have included some code from AN554 in my program.
> I have followed the test examples from Microchip,
> but my program does not work

I'm not surprised. Their app notes are pretty poor.
I started from their AN557, and that has fundamental bugs.
If the slave holds SCL low to wait-state the (PIC) master,
then the AN557 code thinks this is an error state.
I modifed the code to wait until SCL was high,
and extended my application to handle errors properly.
For example, if arbitration fails (SDA conflict)
then back off and retry sending message from the start,
and if negative ack, terminate message.

If you tell us about the application & malfunctions,
we may be able to guess a diagnosis.

Good luck.

BTW, not waiting for SCL to rise is a mistake one of my
colleagues made in his code.
Certain bits were misbehaving repeatably.
He ran his code on his emulator, it got the data
my PIC had sent. "Not my bug" he said.
I wasted weeks combing my code for bugs.
Eventually I said "look at the storage scope -
the signals look perfect. Just what the F***
is wrong with it?". So he puts his emulator on,
single steps, and no malfunction.
Run in real time, malfunction.
"Okay, maybe a timing bug" he says.
Within 20 mins he notices his make-SCL-high
macro does not wait for it to do so.
Changed it to wait, malfunction vanishes!

Next time it won't be my head
I bash against the wall!

1998\02\04@074342 by Steen Jensen

part 0 1240 bytes content-type:text/plain; charset=us-ascii (decoded base64)

ފɲr^~zb ax-z(~

More... (looser matching)
- Last day of these posts
- In 1998 , 1999 only
- Today
- New search...