EmbeddedRelated.com
Forums

I2C example

Started by km5h January 14, 2008
I am trying to use the example code in "Using the USI I2C Code Library
(SLAA368)".
They leave a some essential code necessary out so I am trying to add
the missing code. I am not a very good C programmer (yet).
Has anyone successfully used this code to control an I2C device?

Any comments would be appreciated

Thanks,
Tom Hoflich

Beginning Microcontrollers with the MSP430

TxData0, TxData1, RxData, i , j, at least are not defined anywhere.

Tom
--- In m..., Aaron Greer wrote:
>
> What code do you believe is missing? I played around with that for
a bit a while back and thought it was complete.
> -Aaron
>
> ----- Original Message -----
> From: "km5h"
> To: m...
> Sent: Monday, January 14, 2008 8:01:34 AM (GMT-0700) America/Denver
> Subject: [msp430] I2C example
>
> I am trying to use the example code in "Using the USI I2C Code
Library
> (SLAA368)".
> They leave a some essential code necessary out so I am trying to
add
> the missing code. I am not a very good C programmer (yet).
> Has anyone successfully used this code to control an I2C device?
>
> Any comments would be appreciated
>
> Thanks,
> Tom Hoflich
>
>
>
Yes, there are lots of things left undefined in the examples shown in
SLAA386.pdf

Also, if you use c, make sure you use the same version of the same c
compiler the author used. Otherwise you will need to "port" the code.
(c is "portable", so you need to "port" it from compiler to compiler
and from version to version.)

--- In m..., "km5h" wrote:
>
> TxData0, TxData1, RxData, i , j, at least are not defined anywhere.
>
> Tom
> --- In m..., Aaron Greer wrote:
> >
> > What code do you believe is missing? I played around with that for
> a bit a while back and thought it was complete.
> > -Aaron
> >
> > ----- Original Message -----
> > From: "km5h"
> > To: m...
> > Sent: Monday, January 14, 2008 8:01:34 AM (GMT-0700) America/Denver
> > Subject: [msp430] I2C example
> >
> >
> >
> >
> >
> >
> >
> > I am trying to use the example code in "Using the USI I2C Code
> Library
> > (SLAA368)".
> > They leave a some essential code necessary out so I am trying to
> add
> > the missing code. I am not a very good C programmer (yet).
> > Has anyone successfully used this code to control an I2C device?
> >
> > Any comments would be appreciated
> >
> > Thanks,
> > Tom Hoflich
> >
> >
> >
> >
>
What code do you believe is missing? I played around with that for a bit a while back and thought it was complete.
-Aaron

----- Original Message -----
From: "km5h"
To: m...
Sent: Monday, January 14, 2008 8:01:34 AM (GMT-0700) America/Denver
Subject: [msp430] I2C example

I am trying to use the example code in "Using the USI I2C Code Library
(SLAA368)".
They leave a some essential code necessary out so I am trying to add
the missing code. I am not a very good C programmer (yet).
Has anyone successfully used this code to control an I2C device?

Any comments would be appreciated

Thanks,
Tom Hoflich
Thanks for the link. I have not had a time to work with it but will
soon. It looks like everything is there. I was doing a copy and
past out of the manual. I somehow missed the that the zip file
existed.
I have the Si570 working on a 16F88, but wanted to use the 430.

Sorry for the confusion.
Thanks again
Tom

--- In m..., Aaron Greer wrote:
>
> Tom,
> all those things look fine in my code. Do you have an old copy or
something? Did you download the code in a zip file?
> Here is where I got mine:
> http://focus.ti.com/general/docs/techdocsabstract.tsp?
abstractName=slaa368
> If you can verify that you've got the same zip file of code as me
and if you still don't see those variables defined, can you provide
more details of where you're looking?
> -Aaron
>
> ----- Original Message -----
> From: "km5h"
> To: m...
> Sent: Monday, January 14, 2008 9:08:17 PM (GMT-0700) America/Denver
> Subject: [msp430] Re: I2C example
>
> TxData0, TxData1, RxData, i , j, at least are not defined anywhere.
>
> Tom
>
> --- In m... , Aaron Greer wrote:
> >
> > What code do you believe is missing? I played around with that
for
> a bit a while back and thought it was complete.
> > -Aaron
> >
> > ----- Original Message -----
> > From: "km5h"
> > To: m...
> > Sent: Monday, January 14, 2008 8:01:34 AM (GMT-0700)
America/Denver
> > Subject: [msp430] I2C example
> >
> >
> >
> >
> >
> >
> >
> > I am trying to use the example code in "Using the USI I2C Code
> Library
> > (SLAA368)".
> > They leave a some essential code necessary out so I am trying to
> add
> > the missing code. I am not a very good C programmer (yet).
> > Has anyone successfully used this code to control an I2C device?
> >
> > Any comments would be appreciated
> >
> > Thanks,
> > Tom Hoflich
> >
> >
> >
> >
> >
>
If you use c, you still has to watch out for which revision of which
compiler/linker you are using.

BTW, are you using version 3 of IAR?

--- In m..., "km5h" wrote:
>
> Thanks for the link. I have not had a time to work with it but will
> soon. It looks like everything is there. I was doing a copy and
> past out of the manual. I somehow missed the that the zip file
> existed.
> I have the Si570 working on a 16F88, but wanted to use the 430.
>
> Sorry for the confusion.
> Thanks again
> Tom
>
> --- In m..., Aaron Greer wrote:
> >
> > Tom,
> > all those things look fine in my code. Do you have an old copy or
> something? Did you download the code in a zip file?
> > Here is where I got mine:
> > http://focus.ti.com/general/docs/techdocsabstract.tsp?
> abstractName=slaa368
> > If you can verify that you've got the same zip file of code as me
> and if you still don't see those variables defined, can you provide
> more details of where you're looking?
> > -Aaron
> >
> > ----- Original Message -----
> > From: "km5h"
> > To: m...
> > Sent: Monday, January 14, 2008 9:08:17 PM (GMT-0700) America/Denver
> > Subject: [msp430] Re: I2C example
> >
> >
> >
> >
> >
> >
> >
> > TxData0, TxData1, RxData, i , j, at least are not defined anywhere.
> >
> > Tom
> >
> > --- In m... , Aaron Greer wrote:
> > >
> > > What code do you believe is missing? I played around with that
> for
> > a bit a while back and thought it was complete.
> > > -Aaron
> > >
> > > ----- Original Message -----
> > > From: "km5h"
> > > To: m...
> > > Sent: Monday, January 14, 2008 8:01:34 AM (GMT-0700)
> America/Denver
> > > Subject: [msp430] I2C example
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > I am trying to use the example code in "Using the USI I2C Code
> > Library
> > > (SLAA368)".
> > > They leave a some essential code necessary out so I am trying to
> > add
> > > the missing code. I am not a very good C programmer (yet).
> > > Has anyone successfully used this code to control an I2C device?
> > >
> > > Any comments would be appreciated
> > >
> > > Thanks,
> > > Tom Hoflich
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
> >
>
I've written some code for the i2c interface. Can you post your code
and I'll look through it. Unfortunately, I am not allowed to post
code from that particular project.

--- In m..., "km5h" wrote:
>
> TxData0, TxData1, RxData, i , j, at least are not defined anywhere.
>
> Tom
> --- In m..., Aaron Greer wrote:
> >
> > What code do you believe is missing? I played around with that for
> a bit a while back and thought it was complete.
> > -Aaron
> >
> > ----- Original Message -----
> > From: "km5h"
> > To: m...
> > Sent: Monday, January 14, 2008 8:01:34 AM (GMT-0700) America/Denver
> > Subject: [msp430] I2C example
> >
> >
> >
> >
> >
> >
> >
> > I am trying to use the example code in "Using the USI I2C Code
> Library
> > (SLAA368)".
> > They leave a some essential code necessary out so I am trying to
> add
> > the missing code. I am not a very good C programmer (yet).
> > Has anyone successfully used this code to control an I2C device?
> >
> > Any comments would be appreciated
> >
> > Thanks,
> > Tom Hoflich
> >
> >
> >
> >
>
Tom,
all those things look fine in my code. Do you have an old copy or something? Did you download the code in a zip file?
Here is where I got mine:
http://focus.ti.com/general/docs/techdocsabstract.tsp?abstractName=slaa368
If you can verify that you've got the same zip file of code as me and if you still don't see those variables defined, can you provide more details of where you're looking?
-Aaron

----- Original Message -----
From: "km5h"
To: m...
Sent: Monday, January 14, 2008 9:08:17 PM (GMT-0700) America/Denver
Subject: [msp430] Re: I2C example

TxData0, TxData1, RxData, i , j, at least are not defined anywhere.

Tom

--- In m... , Aaron Greer wrote:
>
> What code do you believe is missing? I played around with that for
a bit a while back and thought it was complete.
> -Aaron
>
> ----- Original Message -----
> From: "km5h"
> To: m...
> Sent: Monday, January 14, 2008 8:01:34 AM (GMT-0700) America/Denver
> Subject: [msp430] I2C example
>
> I am trying to use the example code in "Using the USI I2C Code
Library
> (SLAA368)".
> They leave a some essential code necessary out so I am trying to
add
> the missing code. I am not a very good C programmer (yet).
> Has anyone successfully used this code to control an I2C device?
>
> Any comments would be appreciated
>
> Thanks,
> Tom Hoflich
>
>
>
Yes, I have version 3 of the IAR. However, the file at the link has
a version of 2. I changed it to 3 so that the compile would work.
Hope that was not a bad idea. Or should I go back to version 2 of the
IAR?

Thanks, Tom

--- In m..., "old_cow_yellow"
wrote:
>
> If you use c, you still has to watch out for which revision of which
> compiler/linker you are using.
>
> BTW, are you using version 3 of IAR?
>
> --- In m..., "km5h" wrote:
> >
> > Thanks for the link. I have not had a time to work with it but
will
> > soon. It looks like everything is there. I was doing a copy and
> > past out of the manual. I somehow missed the that the zip file
> > existed.
> > I have the Si570 working on a 16F88, but wanted to use the 430.
> >
> > Sorry for the confusion.
> > Thanks again
> > Tom
> >
> >
> >
> > --- In m..., Aaron Greer wrote:
> > >
> > > Tom,
> > > all those things look fine in my code. Do you have an old copy
or
> > something? Did you download the code in a zip file?
> > > Here is where I got mine:
> > > http://focus.ti.com/general/docs/techdocsabstract.tsp?
> > abstractName=slaa368
> > > If you can verify that you've got the same zip file of code as
me
> > and if you still don't see those variables defined, can you
provide
> > more details of where you're looking?
> > > -Aaron
> > >
> > > ----- Original Message -----
> > > From: "km5h"
> > > To: m...
> > > Sent: Monday, January 14, 2008 9:08:17 PM (GMT-0700)
America/Denver
> > > Subject: [msp430] Re: I2C example
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > TxData0, TxData1, RxData, i , j, at least are not defined
anywhere.
> > >
> > > Tom
> > >
> > > --- In m... , Aaron Greer
wrote:
> > > >
> > > > What code do you believe is missing? I played around with
that
> > for
> > > a bit a while back and thought it was complete.
> > > > -Aaron
> > > >
> > > > ----- Original Message -----
> > > > From: "km5h"
> > > > To: m...
> > > > Sent: Monday, January 14, 2008 8:01:34 AM (GMT-0700)
> > America/Denver
> > > > Subject: [msp430] I2C example
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > I am trying to use the example code in "Using the USI I2C
Code
> > > Library
> > > > (SLAA368)".
> > > > They leave a some essential code necessary out so I am trying
to
> > > add
> > > > the missing code. I am not a very good C programmer (yet).
> > > > Has anyone successfully used this code to control an I2C
device?
> > > >
> > > > Any comments would be appreciated
> > > >
> > > > Thanks,
> > > > Tom Hoflich
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > >
>
What do you mean by "I changed it to 3 so that the compile would work"?

Are you having more luck with the downloaded code? When I used it, it seemed to work OK.

-Aaron

----- Original Message -----
From: "km5h"
To: m...
Sent: Thursday, January 17, 2008 11:14:03 AM (GMT-0700) America/Denver
Subject: [msp430] Re: I2C example

Yes, I have version 3 of the IAR. However, the file at the link has
a version of 2. I changed it to 3 so that the compile would work.
Hope that was not a bad idea. Or should I go back to version 2 of the
IAR?

Thanks, Tom

--- In m... , "old_cow_yellow"
wrote:
>
> If you use c, you still has to watch out for which revision of which
> compiler/linker you are using.
>
> BTW, are you using version 3 of IAR?
>
> --- In m... , "km5h" wrote:
> >
> > Thanks for the link. I have not had a time to work with it but
will
> > soon. It looks like everything is there. I was doing a copy and
> > past out of the manual. I somehow missed the that the zip file
> > existed.
> > I have the Si570 working on a 16F88, but wanted to use the 430.
> >
> > Sorry for the confusion.
> > Thanks again
> > Tom
> >
> >
> >
> > --- In m... , Aaron Greer wrote:
> > >
> > > Tom,
> > > all those things look fine in my code. Do you have an old copy
or
> > something? Did you download the code in a zip file?
> > > Here is where I got mine:
> > > http://focus.ti.com/general/docs/techdocsabstract.tsp?
> > abstractName=slaa368
> > > If you can verify that you've got the same zip file of code as
me
> > and if you still don't see those variables defined, can you
provide
> > more details of where you're looking?
> > > -Aaron
> > >
> > > ----- Original Message -----
> > > From: "km5h"
> > > To: m...
> > > Sent: Monday, January 14, 2008 9:08:17 PM (GMT-0700)
America/Denver
> > > Subject: [msp430] Re: I2C example
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > TxData0, TxData1, RxData, i , j, at least are not defined
anywhere.
> > >
> > > Tom
> > >
> > > --- In m... , Aaron Greer
wrote:
> > > >
> > > > What code do you believe is missing? I played around with
that
> > for
> > > a bit a while back and thought it was complete.
> > > > -Aaron
> > > >
> > > > ----- Original Message -----
> > > > From: "km5h"
> > > > To: m...
> > > > Sent: Monday, January 14, 2008 8:01:34 AM (GMT-0700)
> > America/Denver
> > > > Subject: [msp430] I2C example
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > I am trying to use the example code in "Using the USI I2C
Code
> > > Library
> > > > (SLAA368)".
> > > > They leave a some essential code necessary out so I am trying
to
> > > add
> > > > the missing code. I am not a very good C programmer (yet).
> > > > Has anyone successfully used this code to control an I2C
device?
> > > >
> > > > Any comments would be appreciated
> > > >
> > > > Thanks,
> > > > Tom Hoflich
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > >
>