Searching \ for 'PIC implementation of I2C' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/i2cs.htm?key=i2c
Search entire site for: 'PIC implementation of I2C'.

Truncated match.
PICList Thread
'PIC implementation of I2C'
1998\07\28@135907 by John Bellini

flavicon
face
I am looking to use I2C on a PIC16C74B.  After reading the pages of
information in the Data book, I can't seem to tell what's done in
hardware and what has to be done by the programmer in software.

I know that the ACK is done automatically, but what about the switching
of inputs and outputs when a Master is reading instead of transmitting?
Do the inputs switch to outputs in hardware or does this have to be done
in software?

If anyone has a function/subroutine which performs I2C on a PIC, that
would be useful in understanding.  Any other comments would be
appreciated.

Thanks,
John Bellini

1998\07\29@004541 by tjaart

flavicon
face
John Bellini wrote:

> I am looking to use I2C on a PIC16C74B.  After reading the pages of
> information in the Data book, I can't seem to tell what's done in
> hardware and what has to be done by the programmer in software.
>
> I know that the ACK is done automatically, but what about the switching
> of inputs and outputs when a Master is reading instead of transmitting?
> Do the inputs switch to outputs in hardware or does this have to be done
> in software?
>
> If anyone has a function/subroutine which performs I2C on a PIC, that
> would be useful in understanding.  Any other comments would be
> appreciated.

You'll end up wasting more time and code space trying to get
the built-in I2C to do anything that you can do better in software.

I have a few links to good I2C resources at :
http://www.wasp.co.za/~tjaart/electronicsearch.html

--
Friendly Regards

Tjaart van der Walt
spam_OUTtjaartTakeThisOuTspamwasp.co.za

|--------------------------------------------------|
|                WASP International                |
|R&D Engineer : GSM peripheral services development|
|--------------------------------------------------|
|SMS .....tjaartKILLspamspam@spam@sms.wasp.co.za  (160 chars max)|
|     http://www.wasp.co.za/~tjaart/index.html     |
|Voice: +27-(0)11-622-8686  Fax: +27-(0)11-622-8973|
|          WGS-84 : 26¡10.52'S 28¡06.19'E          |
|--------------------------------------------------|

1998\07\29@035407 by Thomas Magin

flavicon
face
At 10:56 28.07.98 -0700, you wrote:
>I am looking to use I2C on a PIC16C74B.  After reading the pages of

Master or slave mode ?

Thomas
=8-)

--

**********************************************************
* Thomas Magin                  FON:   ++49-761-4543-489 *
* marquette-Hellige GmbH        FAX:                -507 *
* E-FW / Emergency Systems      email: maginspamKILLspamhellige.de  *
* Munzinger Str. 3                                       *
* D-79111 Freiburg / Germany                             *
**********************************************************

1998\07\29@053321 by Keith Howell

flavicon
face
In reply to John Bellini's post,
Being a master is relatively easy, and done by bit-banging in software.
You only need two open-collector outputs for this.
In a multimaster environment, the SSP hardware is useful because you can
monitor the Start (S) bit to ensure you don't start using the bus
if a message has already started. This gives you collision avoidance.

Being a slave requires hardware assistance as you don't wish to sit
around watching bus signals all the time. The SSP provides this.
You set this up to interrupt the CPU every time a complete byte has
arrived or departed from the SSP buffer. It is up to your software
to handle them.

> I know that the ACK is done automatically,
> what about the switching of inputs and outputs when
> a Master is reading instead of transmitting?
> Do the inputs switch to outputs in hardware Yes, the SSP knows the data transf
er direction.
It only bothers the CPU after the transfer is complete.

> If anyone has a function/subroutine which performs I2C on a PIC,
> that would be useful in understanding.

I can't give you the full source but I can tell you the things
that tripped me up and thus you can avoid.

1998\07\29@112313 by craiglee

flavicon
face
I just wish someone would publish a really good slave implementation.  I
would
publish mine, but it still locks up occasionally, and I think I'd have
people
swearing at me!

My experience has been that too many people have struggled with this bear
and
have some valuable time invested in these routines, thus are unwilling to
share
them. Most people, after much struggling, give up and go to a 3 wire bus.
Also,
the implementation can be so different as you can go multimaster, single
master,
400kHz, 100kHz, interrupt, polled.... all of which are specific to the
application
and require different resources.

I've collected many different 'chunks' and hodge podged them together with
the SSP
interrupts for a bus that runs at 45kHz.

Also it's in C.

Craig

>Being a slave requires hardware assistance as you don't wish to sit
>around watching bus signals all the time. The SSP provides this.
>You set this up to interrupt the CPU every time a complete byte has
>arrived or departed from the SSP buffer. It is up to your software
>to handle them.

>I can't give you the full source but I can tell you the things
>that tripped me up and thus you can avoid.

1998\07\29@122628 by John Bellini

flavicon
face
I need both Master and Slave mode.  I need to tell the slave what to do
and extract A/D data from the slave.

{Original Message removed}

1998\07\29@173443 by ronruss

flavicon
face
I put a 16C63 on a board and had no problems. Wrote the code
with CCS C Compiler. Look at http://www.emicros.com for the
description.

Keith Howell wrote:
{Quote hidden}

sfer direction.
> It only bothers the CPU after the transfer is complete.
>
> > If anyone has a function/subroutine which performs I2C on a PIC,
> > that would be useful in understanding.
>
> I can't give you the full source but I can tell you the things
> that tripped me up and thus you can avoid.

--

From:   Ron Russ
  EMICROS  - Embedded Micro Software
               (http://www.emicros.com)
  CANPORT  - Lowest cost PC to Controller Area Network Adapter
               (http://www.emicros.com/canport.htm)
  CANTEC11 - 68HC11 SBC with Controller Area Network
               (http://www.emicros.com/cantec11.htm)

1998\07\29@195823 by Jason Tuendemann

flavicon
face
Ron
I would be interested to know which CCS library you used. Either the bit
bash library or functions written  for the on board SPI??
How long have you been useing CCS and how have you found it??

Thanks...Jason


{Quote hidden}

transfer direction.
{Quote hidden}

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