EmbeddedRelated.com
Forums

I2C example?

Started by upand_at_them August 4, 2004
I'm interested in using a 16F88 with a couple I2C devices and,
looking through the PIC datasheet, it looks WAY more complicated than
me just writing big-bang routines.

Is there a simple example of using the onboard I2C interface or
should I just write the simple big-bang routines?

Mike




I2C routines is complicated if you never used it. Try type on Microchips
web site "I2C" and youll find many applications, routines and detailed
documents about this issue.

Try out !!

Wilson Antonieti Engenharia de Desenvolvimento Tel.: (11) 4223-5117 Fax.:
(11) 4223-5103 Visite nosso site: www.contemp.com.br
PRECIS AO SEU ALCANCE!!!
----- Original Message -----
From: "upand_at_them" <>
To: <>
Sent: Wednesday, August 04, 2004 1:14 AM
Subject: [piclist] I2C example? > I'm interested in using a 16F88 with a couple I2C devices and,
> looking through the PIC datasheet, it looks WAY more complicated than
> me just writing big-bang routines.
>
> Is there a simple example of using the onboard I2C interface or
> should I just write the simple big-bang routines?
>
> Mike >
> to unsubscribe, go to http://www.yahoogroups.com and follow the
instructions
> Yahoo! Groups Links




Mike,

Writing i2c-master routines in bit-bang is not so
hard, but writing i2c-slave routines is a hell of a
job. I succeeded my own projects with multiple
12f629's as slaves and a 16f628a as master, but I have
to confess that my slave-routines are 'polling' and
not interrupt-driven. I've been working on an
interrupt-version, but I did not succeed so far.
If you want, I can send you my routines (assembler).

Greetings,

Kees Stenekes

--- Wilson <> wrote:

> I2C routines is complicated if you never used it.
> Try type on Microchip�s
> web site "I2C" and you�ll find many applications,
> routines and detailed
> documents about this issue.
>
> Try out !! >
>
> Wilson Antonieti Engenharia de Desenvolvimento Tel.:
> (11) 4223-5117 Fax.:
> (11) 4223-5103 Visite nosso
> site: www.contemp.com.br
> PRECIS�O AO SEU ALCANCE!!!
> ----- Original Message -----
> From: "upand_at_them" <>
> To: <>
> Sent: Wednesday, August 04, 2004 1:14 AM
> Subject: [piclist] I2C example? > > I'm interested in using a 16F88 with a couple I2C
> devices and,
> > looking through the PIC datasheet, it looks WAY
> more complicated than
> > me just writing big-bang routines.
> >
> > Is there a simple example of using the onboard I2C
> interface or
> > should I just write the simple big-bang routines?
> >
> > Mike
> >
> >
> >
> >
> >
> >
> > to unsubscribe, go to http://www.yahoogroups.com
> and follow the
> instructions
> > Yahoo! Groups Links
> >
> >
> >
> >
>

__________________________________




Thanks Kees.

I wound up writing the routines. And, like you said, the master
routines aren't difficult. I had never used the native I2C support
of the PIC16F88 and when I realized I had one of these in my parts
bin and that it supported I2C I assumed it was an easy thing to
implement. I don't know why it isn't.

Mike --- In , Kees Stenekes <knalkeez@y...> wrote:
> Mike,
>
> Writing i2c-master routines in bit-bang is not so
> hard, but writing i2c-slave routines is a hell of a
> job. I succeeded my own projects with multiple
> 12f629's as slaves and a 16f628a as master, but I have
> to confess that my slave-routines are 'polling' and
> not interrupt-driven. I've been working on an
> interrupt-version, but I did not succeed so far.
> If you want, I can send you my routines (assembler).
>
> Greetings,
>
> Kees Stenekes
>
> --- Wilson <wantoniet@y...> wrote:
>
> > I2C routines is complicated if you never used it.
> > Try type on Microchip�s
> > web site "I2C" and you�ll find many applications,
> > routines and detailed
> > documents about this issue.
> >
> > Try out !!
> >
> >
> >
> >
> > Wilson Antonieti Engenharia de Desenvolvimento Tel.:
> > (11) 4223-5117 Fax.:
> > (11) 4223-5103 wilson@c... Visite nosso
> > site: www.contemp.com.br
> > PRECIS�O AO SEU ALCANCE!!!
> > ----- Original Message -----
> > From: "upand_at_them" <upand_at_them@y...>
> > To: <>
> > Sent: Wednesday, August 04, 2004 1:14 AM
> > Subject: [piclist] I2C example?
> >
> >
> > > I'm interested in using a 16F88 with a couple I2C
> > devices and,
> > > looking through the PIC datasheet, it looks WAY
> > more complicated than
> > > me just writing big-bang routines.
> > >
> > > Is there a simple example of using the onboard I2C
> > interface or
> > > should I just write the simple big-bang routines?
> > >
> > > Mike
> > >
> > >
> > >
> > >
> > >
> > >
> > > to unsubscribe, go to http://www.yahoogroups.com
> > and follow the
> > instructions
> > > Yahoo! Groups Links
> > >
> > >
> > >
> > >
> > >
> >
> >
>
> __________________________________
>




Mike,

What pic are you using for your slaves? I have done interupt
driven PICs are they are dead easy. I developed a generic code block
thats plug and play and works most of the times. I can send it to
you. I designed a SMPS monitoring system based on a 8-bit 18 leg
device with I2C monitoring, fan speed control, and a whole lot of
funtions. And the pic performed beatifully even with continous
pinging from the master at 750kHz from the master.

BG

--- In , "upand_at_them" <upand_at_them@y...>
wrote:
> Thanks Kees.
>
> I wound up writing the routines. And, like you said, the master
> routines aren't difficult. I had never used the native I2C support
> of the PIC16F88 and when I realized I had one of these in my parts
> bin and that it supported I2C I assumed it was an easy thing to
> implement. I don't know why it isn't.
>
> Mike > --- In , Kees Stenekes <knalkeez@y...> wrote:
> > Mike,
> >
> > Writing i2c-master routines in bit-bang is not so
> > hard, but writing i2c-slave routines is a hell of a
> > job. I succeeded my own projects with multiple
> > 12f629's as slaves and a 16f628a as master, but I have
> > to confess that my slave-routines are 'polling' and
> > not interrupt-driven. I've been working on an
> > interrupt-version, but I did not succeed so far.
> > If you want, I can send you my routines (assembler).
> >
> > Greetings,
> >
> > Kees Stenekes
> >
> > --- Wilson <wantoniet@y...> wrote:
> >
> > > I2C routines is complicated if you never used it.
> > > Try type on Microchip�s
> > > web site "I2C" and you�ll find many applications,
> > > routines and detailed
> > > documents about this issue.
> > >
> > > Try out !!
> > >
> > >
> > >
> > >
> > > Wilson Antonieti Engenharia de Desenvolvimento Tel.:
> > > (11) 4223-5117 Fax.:
> > > (11) 4223-5103 wilson@c... Visite nosso
> > > site: www.contemp.com.br
> > > PRECIS�O AO SEU ALCANCE!!!
> > > ----- Original Message -----
> > > From: "upand_at_them" <upand_at_them@y...>
> > > To: <>
> > > Sent: Wednesday, August 04, 2004 1:14 AM
> > > Subject: [piclist] I2C example?
> > >
> > >
> > > > I'm interested in using a 16F88 with a couple I2C
> > > devices and,
> > > > looking through the PIC datasheet, it looks WAY
> > > more complicated than
> > > > me just writing big-bang routines.
> > > >
> > > > Is there a simple example of using the onboard I2C
> > > interface or
> > > > should I just write the simple big-bang routines?
> > > >
> > > > Mike
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > to unsubscribe, go to http://www.yahoogroups.com
> > > and follow the
> > > instructions
> > > > Yahoo! Groups Links
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
> >
> >
> > __________________________________
> >




I'm not using a PIC slave; I'm using a PIC16F88 master with a MAX127
ADC slave. Which is why I thought the builtin support should have
been easy.

Mike

--- In , "bg3009" <bg3009@y...> wrote:
> Mike,
>
> What pic are you using for your slaves? I have done interupt
> driven PICs are they are dead easy. I developed a generic code
block
> thats plug and play and works most of the times. I can send it to
> you. I designed a SMPS monitoring system based on a 8-bit 18 leg
> device with I2C monitoring, fan speed control, and a whole lot of
> funtions. And the pic performed beatifully even with continous
> pinging from the master at 750kHz from the master.
>
> BG
>
> --- In , "upand_at_them"
<upand_at_them@y...>
> wrote:
> > Thanks Kees.
> >
> > I wound up writing the routines. And, like you said, the master
> > routines aren't difficult. I had never used the native I2C
support
> > of the PIC16F88 and when I realized I had one of these in my
parts
> > bin and that it supported I2C I assumed it was an easy thing to
> > implement. I don't know why it isn't.
> >
> > Mike
> >
> >
> > --- In , Kees Stenekes <knalkeez@y...>
wrote:
> > > Mike,
> > >
> > > Writing i2c-master routines in bit-bang is not so
> > > hard, but writing i2c-slave routines is a hell of a
> > > job. I succeeded my own projects with multiple
> > > 12f629's as slaves and a 16f628a as master, but I have
> > > to confess that my slave-routines are 'polling' and
> > > not interrupt-driven. I've been working on an
> > > interrupt-version, but I did not succeed so far.
> > > If you want, I can send you my routines (assembler).
> > >
> > > Greetings,
> > >
> > > Kees Stenekes
> > >
> > > --- Wilson <wantoniet@y...> wrote:
> > >
> > > > I2C routines is complicated if you never used it.
> > > > Try type on Microchip�s
> > > > web site "I2C" and you�ll find many applications,
> > > > routines and detailed
> > > > documents about this issue.
> > > >
> > > > Try out !!
> > > >
> > > >
> > > >
> > > >
> > > > Wilson Antonieti Engenharia de Desenvolvimento Tel.:
> > > > (11) 4223-5117 Fax.:
> > > > (11) 4223-5103 wilson@c... Visite nosso
> > > > site: www.contemp.com.br
> > > > PRECIS�O AO SEU ALCANCE!!!
> > > > ----- Original Message -----
> > > > From: "upand_at_them" <upand_at_them@y...>
> > > > To: <>
> > > > Sent: Wednesday, August 04, 2004 1:14 AM
> > > > Subject: [piclist] I2C example?
> > > >
> > > >
> > > > > I'm interested in using a 16F88 with a couple I2C
> > > > devices and,
> > > > > looking through the PIC datasheet, it looks WAY
> > > > more complicated than
> > > > > me just writing big-bang routines.
> > > > >
> > > > > Is there a simple example of using the onboard I2C
> > > > interface or
> > > > > should I just write the simple big-bang routines?
> > > > >
> > > > > Mike
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > to unsubscribe, go to http://www.yahoogroups.com
> > > > and follow the
> > > > instructions
> > > > > Yahoo! Groups Links
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > > __________________________________
> > >





The built-in support is quite complex because the hardware has to
deal with a lot of issues that may occur on the bus. Now, if you
have just one device hanging out there and you don't have some 'real-
time' requirement, bit-banging is pretty easy to code. You can find
examples all over the Internet including www.piclist.com.

Still, the app notes from Microchip have the master code and, I
would assume, would work with your chip. In fact, one of the app
notes is for a distributed control system as might be used in a
building HVAC system.

Philips Semiconductor invented, and has still, the best app notes on
I2C.
--- In , "upand_at_them" <upand_at_them@y...>
wrote:
> I'm not using a PIC slave; I'm using a PIC16F88 master with a
MAX127
> ADC slave. Which is why I thought the builtin support should have
> been easy.
>
> Mike
>
> --- In , "bg3009" <bg3009@y...> wrote:
> > Mike,
> >
> > What pic are you using for your slaves? I have done
interupt
> > driven PICs are they are dead easy. I developed a generic code
> block
> > thats plug and play and works most of the times. I can send it
to
> > you. I designed a SMPS monitoring system based on a 8-bit 18 leg
> > device with I2C monitoring, fan speed control, and a whole lot
of
> > funtions. And the pic performed beatifully even with continous
> > pinging from the master at 750kHz from the master.
> >
> > BG
> >
> > --- In , "upand_at_them"
> <upand_at_them@y...>
> > wrote:
> > > Thanks Kees.
> > >
> > > I wound up writing the routines. And, like you said, the
master
> > > routines aren't difficult. I had never used the native I2C
> support
> > > of the PIC16F88 and when I realized I had one of these in my
> parts
> > > bin and that it supported I2C I assumed it was an easy thing
to
> > > implement. I don't know why it isn't.
> > >
> > > Mike
> > >
> > >
> > > --- In , Kees Stenekes <knalkeez@y...>
> wrote:
> > > > Mike,
> > > >
> > > > Writing i2c-master routines in bit-bang is not so
> > > > hard, but writing i2c-slave routines is a hell of a
> > > > job. I succeeded my own projects with multiple
> > > > 12f629's as slaves and a 16f628a as master, but I have
> > > > to confess that my slave-routines are 'polling' and
> > > > not interrupt-driven. I've been working on an
> > > > interrupt-version, but I did not succeed so far.
> > > > If you want, I can send you my routines (assembler).
> > > >
> > > > Greetings,
> > > >
> > > > Kees Stenekes
> > > >
> > > > --- Wilson <wantoniet@y...> wrote:
> > > >
> > > > > I2C routines is complicated if you never used it.
> > > > > Try type on Microchip�s
> > > > > web site "I2C" and you�ll find many applications,
> > > > > routines and detailed
> > > > > documents about this issue.
> > > > >
> > > > > Try out !!
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Wilson Antonieti Engenharia de Desenvolvimento Tel.:
> > > > > (11) 4223-5117 Fax.:
> > > > > (11) 4223-5103 wilson@c... Visite nosso
> > > > > site: www.contemp.com.br
> > > > > PRECIS�O AO SEU ALCANCE!!!
> > > > > ----- Original Message -----
> > > > > From: "upand_at_them" <upand_at_them@y...>
> > > > > To: <>
> > > > > Sent: Wednesday, August 04, 2004 1:14 AM
> > > > > Subject: [piclist] I2C example?
> > > > >
> > > > >
> > > > > > I'm interested in using a 16F88 with a couple I2C
> > > > > devices and,
> > > > > > looking through the PIC datasheet, it looks WAY
> > > > > more complicated than
> > > > > > me just writing big-bang routines.
> > > > > >
> > > > > > Is there a simple example of using the onboard I2C
> > > > > interface or
> > > > > > should I just write the simple big-bang routines?
> > > > > >
> > > > > > Mike
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > to unsubscribe, go to http://www.yahoogroups.com
> > > > > and follow the
> > > > > instructions
> > > > > > Yahoo! Groups Links
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > >
> > > > __________________________________
> > > >





Yes I agree here. I think a PIC with I2C master functions will take
care of timing issues and so on easily. The notes from Philips gives
a detailed treatment on the subject. And it deals with important
details also. Very soon, I am planning to built a home automation
system for my house to control the lights, windows, basic security.

BG

--- In , "rtstofer" <rstofer@p...> wrote:
>


> The built-in support is quite complex because the hardware has to
> deal with a lot of issues that may occur on the bus. Now, if you
> have just one device hanging out there and you don't have
some 'real-
> time' requirement, bit-banging is pretty easy to code. You can
find
> examples all over the Internet including www.piclist.com.
>
> Still, the app notes from Microchip have the master code and, I
> would assume, would work with your chip. In fact, one of the app
> notes is for a distributed control system as might be used in a
> building HVAC system.
>
> Philips Semiconductor invented, and has still, the best app notes
on
> I2C. >
> --- In , "upand_at_them"
<upand_at_them@y...>
> wrote:
> > I'm not using a PIC slave; I'm using a PIC16F88 master with a
> MAX127
> > ADC slave. Which is why I thought the builtin support should
have
> > been easy.
> >
> > Mike
> >
> > --- In , "bg3009" <bg3009@y...> wrote:
> > > Mike,
> > >
> > > What pic are you using for your slaves? I have done
> interupt
> > > driven PICs are they are dead easy. I developed a generic code
> > block
> > > thats plug and play and works most of the times. I can send it
> to
> > > you. I designed a SMPS monitoring system based on a 8-bit 18
leg
> > > device with I2C monitoring, fan speed control, and a whole lot
> of
> > > funtions. And the pic performed beatifully even with continous
> > > pinging from the master at 750kHz from the master.
> > >
> > > BG
> > >
> > > --- In , "upand_at_them"
> > <upand_at_them@y...>
> > > wrote:
> > > > Thanks Kees.
> > > >
> > > > I wound up writing the routines. And, like you said, the
> master
> > > > routines aren't difficult. I had never used the native I2C
> > support
> > > > of the PIC16F88 and when I realized I had one of these in my
> > parts
> > > > bin and that it supported I2C I assumed it was an easy thing
> to
> > > > implement. I don't know why it isn't.
> > > >
> > > > Mike
> > > >
> > > >
> > > > --- In , Kees Stenekes <knalkeez@y...>
> > wrote:
> > > > > Mike,
> > > > >
> > > > > Writing i2c-master routines in bit-bang is not so
> > > > > hard, but writing i2c-slave routines is a hell of a
> > > > > job. I succeeded my own projects with multiple
> > > > > 12f629's as slaves and a 16f628a as master, but I have
> > > > > to confess that my slave-routines are 'polling' and
> > > > > not interrupt-driven. I've been working on an
> > > > > interrupt-version, but I did not succeed so far.
> > > > > If you want, I can send you my routines (assembler).
> > > > >
> > > > > Greetings,
> > > > >
> > > > > Kees Stenekes
> > > > >
> > > > > --- Wilson <wantoniet@y...> wrote:
> > > > >
> > > > > > I2C routines is complicated if you never used it.
> > > > > > Try type on Microchip�s
> > > > > > web site "I2C" and you�ll find many applications,
> > > > > > routines and detailed
> > > > > > documents about this issue.
> > > > > >
> > > > > > Try out !!
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > Wilson Antonieti Engenharia de Desenvolvimento Tel.:
> > > > > > (11) 4223-5117 Fax.:
> > > > > > (11) 4223-5103 wilson@c... Visite nosso
> > > > > > site: www.contemp.com.br
> > > > > > PRECIS�O AO SEU ALCANCE!!!
> > > > > > ----- Original Message -----
> > > > > > From: "upand_at_them" <upand_at_them@y...>
> > > > > > To: <>
> > > > > > Sent: Wednesday, August 04, 2004 1:14 AM
> > > > > > Subject: [piclist] I2C example?
> > > > > >
> > > > > >
> > > > > > > I'm interested in using a 16F88 with a couple I2C
> > > > > > devices and,
> > > > > > > looking through the PIC datasheet, it looks WAY
> > > > > > more complicated than
> > > > > > > me just writing big-bang routines.
> > > > > > >
> > > > > > > Is there a simple example of using the onboard I2C
> > > > > > interface or
> > > > > > > should I just write the simple big-bang routines?
> > > > > > >
> > > > > > > Mike
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > to unsubscribe, go to http://www.yahoogroups.com
> > > > > > and follow the
> > > > > > instructions
> > > > > > > Yahoo! Groups Links
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > __________________________________
> > > > >



Hmmm, I don't know about Mike, but I am very
interested in your interrupt-driven code (cause it
drives me nuts)

Kees
--- bg3009 <> wrote:

> Mike,
>
> What pic are you using for your slaves? I have
> done interupt
> driven PICs are they are dead easy. I developed a
> generic code block
> thats plug and play and works most of the times. I
> can send it to
> you. I designed a SMPS monitoring system based on a
> 8-bit 18 leg
> device with I2C monitoring, fan speed control, and a
> whole lot of
> funtions. And the pic performed beatifully even with
> continous
> pinging from the master at 750kHz from the master.
>
> BG
>
> --- In , "upand_at_them"
> <upand_at_them@y...>
> wrote:
> > Thanks Kees.
> >
> > I wound up writing the routines. And, like you
> said, the master
> > routines aren't difficult. I had never used the
> native I2C support
> > of the PIC16F88 and when I realized I had one of
> these in my parts
> > bin and that it supported I2C I assumed it was an
> easy thing to
> > implement. I don't know why it isn't.
> >
> > Mike
> >
> >
> > --- In , Kees Stenekes
> <knalkeez@y...> wrote:
> > > Mike,
> > >
> > > Writing i2c-master routines in bit-bang is not
> so
> > > hard, but writing i2c-slave routines is a hell
> of a
> > > job. I succeeded my own projects with multiple
> > > 12f629's as slaves and a 16f628a as master, but
> I have
> > > to confess that my slave-routines are 'polling'
> and
> > > not interrupt-driven. I've been working on an
> > > interrupt-version, but I did not succeed so far.
> > > If you want, I can send you my routines
> (assembler).
> > >
> > > Greetings,
> > >
> > > Kees Stenekes
> > >
> > > --- Wilson <wantoniet@y...> wrote:
> > >
> > > > I2C routines is complicated if you never used
> it.
> > > > Try type on Microchip�s
> > > > web site "I2C" and you�ll find many
> applications,
> > > > routines and detailed
> > > > documents about this issue.
> > > >
> > > > Try out !!
> > > >
> > > >
> > > >
> > > >
> > > > Wilson Antonieti Engenharia de Desenvolvimento
> Tel.:
> > > > (11) 4223-5117 Fax.:
> > > > (11) 4223-5103 wilson@c... Visite nosso
> > > > site: www.contemp.com.br
> > > > PRECIS�O AO SEU ALCANCE!!!
> > > > ----- Original Message -----
> > > > From: "upand_at_them" <upand_at_them@y...>
> > > > To: <>
> > > > Sent: Wednesday, August 04, 2004 1:14 AM
> > > > Subject: [piclist] I2C example?
> > > >
> > > >
> > > > > I'm interested in using a 16F88 with a
> couple I2C
> > > > devices and,
> > > > > looking through the PIC datasheet, it looks
> WAY
> > > > more complicated than
> > > > > me just writing big-bang routines.
> > > > >
> > > > > Is there a simple example of using the
> onboard I2C
> > > > interface or
> > > > > should I just write the simple big-bang
> routines?
> > > > >
> > > > > Mike
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > to unsubscribe, go to
> http://www.yahoogroups.com
> > > > and follow the
> > > > instructions
> > > > > Yahoo! Groups Links
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > > __________________________________
> >


__________________________________



Hi all

I m using 16F877 Controller and the LCD display in my system ,my other process in the system effects the display oftenly.

Can I use an buffer ( line driver between LCD and Microchip),When i check with the Osciloscope i saw all the singmal amd control line & power line of the LCD has some  noise.Due to this noise the display collapse( shift by one character) after few hrs then need to restart then its ok,

thanks,

ramesh